Post Reply  Post Thread 
Pages (3): « First [1] 2 3 Next > Last »
Multi forum server optimization ?
tomek
Junior Member
**

Posts: 15
Group: Registered
Joined: Aug 2006
Status: Offline
Reputation: 0
Post: #1
Question Multi forum server optimization ?

Hi,

I have got a server which is using as a free forum hosting server. My server has got only 320 MB ram (512 at the end of this week). I have got many database, one for each forum.

There is lstat graph:

System


Memory


CPU


You can also see status from phpmyadmin:

Status forum phpmyadmin

This is my.cnf:

Quote:
# Example MySQL config file for medium systems.
#
# This is for a system with little memory (32M - 64M) where MySQL plays
# an important part, or systems up to 128M where MySQL is used together with
# other programs (such as a web server)
#
# You can copy this file to
# /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options (in this
# installation this directory is /var/lib/mysql) or
# ~/.my.cnf to set user-specific options.
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.

# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /var/run/mysql/mysql.sock

# Here follows entries for some specific programs

# The MySQL server
[mysqld]
port = 3306
socket = /var/run/mysql/mysql.sock
skip-locking
key_buffer = 224M
max_allowed_packet = 1M
table_cache = 256
sort_buffer_size = 4M
net_buffer_length = 8K
read_buffer_size = 1M
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M

# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
#
#skip-networking

# Replication Master Server (default)
# binary logging is required for replication
log-bin

# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id = 1

# Replication Slave (comment out master section to use this)
#
# To configure this host as a replication slave, you can choose between
# two methods :
#
# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
# the syntax is:
#
# CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
# MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
#
# where you replace <host>, <user>, <password> by quoted strings and
# <port> by the master's port number (3306 by default).
#
# Example:
#
# CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
# MASTER_USER='joe', MASTER_PASSWORD='secret';
#
# OR
#
# 2) Set the variables below. However, in case you choose this method, then
# start replication for the first time (even unsuccessfully, for example
# if you mistyped the password in master-password and the slave fails to
# connect), the slave will create a master.info file, and any later
# change in this file to the variables' values below will be ignored and
# overridden by the content of the master.info file, unless you shutdown
# the slave server, delete master.info and restart the slaver server.
# For that reason, you may want to leave the lines below untouched
# (commented) and instead use CHANGE MASTER TO (see above)
#
# required unique id between 2 and 2^32 - 1
# (and different from the master)
# defaults to 2 if master-host is set
# but will not function as a slave if omitted
#server-id = 2
#
# The replication master for this slave - required
#master-host = <hostname>
#
# The username the slave will use for authentication when connecting
# to the master - required
#master-user = <username>
#
# The password the slave will authenticate with when connecting to
# the master - required
#master-password = <password>
#
# The port the master is listening on.
# optional - defaults to 3306
#master-port = <port>
#
# binary logging - not required for slaves, but recommended
#log-bin

# Point the following paths to different dedicated disks
#tmpdir = /tmp/
#log-update = /path-to-dedicated-directory/hostname

# Uncomment the following if you are using BDB tables
#bdb_cache_size = 4M
#bdb_max_lock = 10000

# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /var/lib/mysql/
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = /var/lib/mysql/
#innodb_log_arch_dir = /var/lib/mysql/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 16M
#innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 5M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates

[isamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M

[myisamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout


I will be grateful for a help.

08-14-2006 09:21 PM
Find all posts by this user Quote this message in a reply
Pacifier
Administrator
*******

Posts: 222
Group: Administrators
Joined: May 2006
Status: Offline
Reputation: 1
Post: #2
RE: Multi forum server optimization ?

Please provide the output of "top" and "free -m" commands from ssh and I'll be able to better help with your optimizations.
If your httpd (apache) is on the same server, then please do let me know key settings such as TimeOut, KeepAlive, KeepAliveTimeout, MaxClients, Minspareservers and maxspareservers (from httpd.conf file).

08-15-2006 06:57 AM
Find all posts by this user Quote this message in a reply
tomek
Junior Member
**

Posts: 15
Group: Registered
Joined: Aug 2006
Status: Offline
Reputation: 0
Post: #3
RE: Multi forum server optimization ?

TOP

Code:
top - 09:51:50 up 10 days, 19:58,  1 user,  load average: 0.66, 1.02, 1.02
Tasks:  84 total,   1 running,  83 sleeping,   0 stopped,   0 zombie
Cpu(s):   5.2% user,   7.0% system,   0.0% nice,  87.8% idle
Mem:    320968k total,   316128k used,     4840k free,    22888k buffers
Swap:   248968k total,    56228k used,   192740k free,    43648k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
14837 root      14   0  1084 1084  840 R  6.8  0.3   0:00.92 top
1434 nobody    11   0  7900 7884 5108 S  2.5  2.5   1:51.16 httpd
14842 mysql     10   0  138m  90m 2708 S  0.9 28.8   0:00.03 mysqld
1435 nobody     9   0  7924 7908 5112 S  0.6  2.5   1:31.25 httpd
8455 nobody     9   0  6744 6724 5144 S  0.6  2.1   0:25.96 httpd
    1 root       8   0    72   64   44 S  0.0  0.0   0:03.58 init
    2 root       9   0     0    0    0 S  0.0  0.0   0:00.02 keventd
    3 root      19  19     0    0    0 S  0.0  0.0   0:00.61 ksoftirqd_CPU0
    4 root       9   0     0    0    0 S  0.0  0.0   2:56.38 kswapd
    5 root       9   0     0    0    0 S  0.0  0.0   0:00.00 bdflush
    6 root       9   0     0    0    0 S  0.0  0.0  11:18.39 kupdated
    7 root       9   0     0    0    0 S  0.0  0.0   0:00.00 ahc_dv_0
    8 root       9   0     0    0    0 S  0.0  0.0   0:00.00 scsi_eh_0
    9 root       9   0     0    0    0 S  0.0  0.0   0:03.12 kreiserfsd
   62 root       9   0   312  292  232 S  0.0  0.1   0:07.23 syslogd
   65 root       9   0   196  184  184 S  0.0  0.1   0:00.03 klogd
  221 root       8   0   156  132  100 S  0.0  0.0   0:00.40 inetd
  225 root       9   0   756  600  512 S  0.0  0.2   0:17.38 sshd
  233 root       8   0   376  352  292 S  0.0  0.1   0:00.53 crond
  236 root       8   0  1256  744  580 S  0.0  0.2   0:05.63 sendmail
  239 smmsp      8   0   776  360  252 S  0.0  0.1   0:00.05 sendmail
  290 root       8   0  4804 4784 4744 S  0.0  1.5   0:29.60 httpd
  301 root       8   0  4136 1536  716 S  0.0  0.5   0:33.64 lstatd
  305 root       9   0   156  108  108 S  0.0  0.0   0:00.00 agetty
  306 root       9   0    52    4    4 S  0.0  0.0   0:00.00 agetty
  307 root       9   0    52    4    4 S  0.0  0.0   0:00.00 agetty
  308 root       9   0    52    4    4 S  0.0  0.0   0:00.01 agetty
  309 root       9   0    52    4    4 S  0.0  0.0   0:00.00 agetty
  343 root       9   0    52    4    4 S  0.0  0.0   0:00.00 agetty
29413 nobody     9   0   612  484  460 S  0.0  0.2   0:00.00 in.identd
29415 nobody     8   0   612  484  460 S  0.0  0.2   0:00.09 in.identd
29416 nobody     9   0   612  484  460 S  0.0  0.2   0:00.20 in.identd
29417 nobody     9   0   612  484  460 S  0.0  0.2   0:00.14 in.identd
29418 nobody     9   0   612  484  460 S  0.0  0.2   0:00.14 in.identd
29419 nobody     9   0   612  484  460 S  0.0  0.2   0:00.08 in.identd
29420 nobody     9   0   612  484  460 S  0.0  0.2   0:00.00 in.identd
8051 root       9   0  3700 1552  960 S  0.0  0.5   0:02.06 miniserv.pl


free -m

Code:
total       used       free     shared    buffers     cached
Mem:           313        306          7          0         15         35
-/+ buffers/cache:        255         57
Swap:          243         54        188


Apache 1.3.33

Code:
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
MaxClients 150
MinSpareServers 5
MaxSpareServers 10

08-15-2006 08:05 AM
Find all posts by this user Quote this message in a reply
Pacifier
Administrator
*******

Posts: 222
Group: Administrators
Joined: May 2006
Status: Offline
Reputation: 1
Post: #4
RE: Multi forum server optimization ?

Make the following changes in your httpd.conf:

Code:
Timeout 30
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 4
MaxClients 150
MinSpareServers 5
MaxSpareServers 10


and the following in your my.cnf file:

Code:
# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /var/run/mysql/mysql.sock

# Here follows entries for some specific programs

# The MySQL server
[mysqld]
port = 3306
socket = /var/run/mysql/mysql.sock
skip-locking
key_buffer = 64M
max_allowed_packet = 1M
table_cache = 256
sort_buffer_size = 1M
join_buffer_size = 1M
net_buffer_length = 8K
read_buffer_size = 512K
read_rnd_buffer_size = 1M
myisam_sort_buffer_size = 8M
#log-bin
server-id = 1

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates

[isamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M

[myisamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout


Make sure to restart your apache and mysqld after making the changes.

08-15-2006 08:16 AM
Find all posts by this user Quote this message in a reply
tomek
Junior Member
**

Posts: 15
Group: Registered
Joined: Aug 2006
Status: Offline
Reputation: 0
Post: #5
RE: Multi forum server optimization ?

Thx. I hope that key_buffer=64MB is enough Thinking

Can you write me what that server-id = 1 means ?

And one more question: can I delete log files like ib_logfile0, ibdata1 ext. ?

08-15-2006 08:35 AM
Find all posts by this user Quote this message in a reply
Pacifier
Administrator
*******

Posts: 222
Group: Administrators
Joined: May 2006
Status: Offline
Reputation: 1
Post: #6
RE: Multi forum server optimization ?

64MB keybuffer should be enough. Since you're running low on ram, you can try to lower it even more and it will switch to disk writing instead of ram writing.

You need not worry about server-id and you can remove it if you want. It is used in mysql replication.

You may delete those log files if really needed.

08-15-2006 12:20 PM
Find all posts by this user Quote this message in a reply
tomek
Junior Member
**

Posts: 15
Group: Registered
Joined: Aug 2006
Status: Offline
Reputation: 0
Post: #7
RE: Multi forum server optimization ?

One more question. What would you change if I have 512 MB ram ?

08-15-2006 12:27 PM
Find all posts by this user Quote this message in a reply
Pacifier
Administrator
*******

Posts: 222
Group: Administrators
Joined: May 2006
Status: Offline
Reputation: 1
Post: #8
RE: Multi forum server optimization ?

I don't think 512mb is a very big change. I would be give larger buffers for key_buffer, table_cache, read_rnd_buffer_size, sort_buffer_size and myisam_buffer_size if it was an upgrade to 1gb. Otherwise, if you wish, you can try increasing the value of these settings a bit. All they can offer is "more speed" as long as your system has enough memory to support the high value or else they will rather slow down your system.

08-15-2006 09:29 PM
Find all posts by this user Quote this message in a reply
tomek
Junior Member
**

Posts: 15
Group: Registered
Joined: Aug 2006
Status: Offline
Reputation: 0
Post: #9
RE: Multi forum server optimization ?

How about using query_cache_size ? Should I use it ?

08-16-2006 07:21 AM
Find all posts by this user Quote this message in a reply
Pacifier
Administrator
*******

Posts: 222
Group: Administrators
Joined: May 2006
Status: Offline
Reputation: 1
Post: #10
RE: Multi forum server optimization ?

You cannot use it when you have so less ram and then again query cache isn't really very helpful on the dynamic environment of forums.

08-16-2006 01:09 PM
Find all posts by this user Quote this message in a reply
Pages (3): « First [1] 2 3 Next > Last »
Post Reply  Post Thread 

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: