DragonPrime - LoGD Resource Community
Welcome Guest
  • Good afternoon, Guest.
    Please log in, or register.
  • February 20, 2019, 01:16:32 PM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: [1]   Go Down
  Print  
Author Topic: Server Performance  (Read 6178 times)
0 Members and 1 Guest are viewing this topic.
RPGSL
Guest
« on: April 13, 2005, 06:46:30 AM »

I just moved to a dedicated server. I bought the basic package to start out with. Here are the specs:

Celereon 2.4
512 MB
40 GB
1000 GB Transfer
Linux 2.6.9-041221
php 4.3.10-2.4  
mysql 3.23.58-9.1  
psa v7.5.2_build75050204.17 os_FedoraCore 2

The game has about 300 mods installed. I reboot the system and it comes backup with about 45-50% memory being used, but it appears to take up more memory usage everytime a player clicks a link, it increases slightly, but never decreases, so after a few minutes of play, the memory usage is back up to 95%

I have the php memory set at 64M.

Any help on this issue would be appreciated. I know this isn't terribly detailed, but just let me know what you want to know and I'll provide it.

Obviously something is wrong. I went through all of the modules yesterday one by one to test them. The only debug I got was for slow queries and updates. So, I'm not sure what the issue may be, but I thought someone here may have some experience with this matter.

Thanks.
« Last Edit: April 13, 2005, 06:49:05 AM by RPGSL » Logged
Kendaer
Guest
« Reply #1 on: April 13, 2005, 07:12:25 AM »

ok.

First, what process is taking up the memory?
Second, why the heck are you running 300+ modules? Smiley
Logged
Kendaer
Guest
« Reply #2 on: April 13, 2005, 07:14:39 AM »

For the record, on central and on dragoncat, both, the memory use does not increase this way.  I don't have any real suggestions as to what might be occuring without more info.
Logged
MightyE
Global Moderator
Captain of the Guard
*****
Offline Offline

Posts: 104


Game Creator MIGHTYE


View Profile
« Reply #3 on: April 13, 2005, 07:24:46 AM »

300 modules is a lot of modules, you might think about cutting back on this.

Also, the 64mb limit is only necessary during the install till we can get the memory size problem addressed, you can probably set it back to the default once install is complete.  With 300 modules though, I suppose it's possible that you will need a bit higher than normal memory limit, as (especially not knowing how the modules hook) you might end up with 100 or more injected on any given hit, which seems to be about the problem threshold.

Check your apache number of children limit, central has MaxClients of 48, and I have a separate server running the database.  You might want to put MaxClients at around 25 or less.  Basically you should have the highest value for MaxClients before you begin to swap.  When I had 1gig of RAM and mysqld on the same box as httpd, I think my max clients was 22.  If more than 22 people were currently being served, additional requests were queued up until a child process is available.  It's a transparent process for the user, and having a low-enough value here will significantly increase overall performance because it reduces your memory footprint under heavy load.

You'll see your memory usage go up to the system limit pretty quickly even on a pretty quiet box, as a matter of how Linux manages its memory usage, you will have no problem until it starts to swap (a small amount of data in swap is to be expected, central has 35852k currently, but we are not thrashing swap).

If you're using persistent connections and have DB on the same server as HTTPD, you'll want to change back to non-persistent connections.  Persistent connections tie up a lot of resources, but are very useful when you have high database connection latency (such as if your database were in a different data center from your http server).

Turn on the data caching feature, and for added performance, use a RAMdisk for your data caching directory, eg put this in your /etc/fstab:
/dev/shm                /mnt/ramdisk            tmpfs   size=10m        0 0
create an empty directory in /mnt/ramdisk (mkdir /mnt/ramdisk), and point the data caching feature at /mnt/ramdisk to store its files.  You can probably get away with a 5 or 6mb ramdisk for data caching currently, Central's data cache is currently 4.3M.  This will reduce the number of queries hitting the database, and significantly increase performance, and even the memory footprint of MySQL for an initial usage of the amount of RAM in your RAMdisk.  All child threads will share that data, so it is a fixed overhead that won't increase as your number of requests goes up.

Hope it helps.
Logged
RPGSL
Guest
« Reply #4 on: April 13, 2005, 07:30:04 AM »

I'll try all of those suggestions. Thank you.

Here is a process list through shell:

F S   UID   PID  PPID  C PRI  NI ADDR SZ WCHAN  TTY          TIME CMD
4 S     0     1     0  0  76   0 -   369 select ?        00:00:00 init
1 S     0     2     1  0 -40   0 -     0 migrat ?        00:00:00 migration/0
1 S     0     3     1  0  94  19 -     0 ksofti ?        00:00:00 ksoftirqd/0
1 S     0     4     1  0  65 -10 -     0 worker ?        00:00:00 events/0
1 S     0     5     4  0  65 -10 -     0 worker ?        00:00:00 khelper
1 S     0     6     4  0  65 -10 -     0 worker ?        00:00:00 kblockd/0
1 S     0     7     4  0  80   0 -     0 pdflus ?        00:00:00 pdflush
1 S     0     8     4  0  75   0 -     0 pdflus ?        00:00:00 pdflush
1 S     0    10     4  0  73 -10 -     0 worker ?        00:00:00 aio/0
1 S     0     9     1  0  85   0 -     0 kswapd ?        00:00:00 kswapd0
1 S     0    11     4  0  65 -10 -     0 worker ?        00:00:00 xfslogd/0
1 S     0    12     4  0  73 -10 -     0 worker ?        00:00:00 xfsdatad/0
1 S     0    13     1  0  75   0 -     0 324380 ?        00:00:00 xfsbufd
1 S     0    14     1  0  85   0 -     0 serio_ ?        00:00:00 kseriod
1 S     0    15     4  0  66 -10 -     0 worker ?        00:00:00 ata/0
1 S     0    16     1  0  75   0 -     0 kjourn ?        00:00:00 kjournald
1 S     0   127     1  0  75   0 -     0 -      ?        00:00:00 xfssyncd
1 S     0   128     1  0  75   0 -     0 -      ?        00:00:00 xfssyncd
1 S     0   129     1  0  75   0 -     0 -      ?        00:00:00 xfssyncd
5 S     0   402     1  0  76   0 -   496 select ?        00:00:00 dhclient
5 S     0   441     1  0  76   0 -   366 select ?        00:00:00 syslogd
5 S     0   445     1  0  76   0 -   352 syslog ?        00:00:00 klogd
5 S     0   494     1  0  77   0 -   428 sysent ?        00:00:00 smartd
1 S    25   508     1  0  78   0 -  7469 rt_sig ?        00:00:00 named
5 S     0   524     1  0  76   0 -   915 select ?        00:00:00 sshd
5 S     0   537     1  0  77   0 -   503 select ?        00:00:00 xinetd
4 S     0   549     1  0  78   0 -  1034 wait   ?        00:00:00 safe_mysqld
4 S    27   574   549  0  76   0 - 26668 select ?        00:00:00 mysqld
5 S     0   607     1  0  83   0 -   871 select ?        00:00:00 couriertcpd
4 S     0   610     1  0  80   0 -   812 pipe_w ?        00:00:00 courierlogger
5 S     0   619     1  0  85   0 -   871 select ?        00:00:00 couriertcpd
4 S     0   622     1  0  85   0 -   812 pipe_w ?        00:00:00 courierlogger
5 S     0   629     1  0  82   0 -   871 select ?        00:00:00 couriertcpd
4 S     0   631     1  0  85   0 -   812 pipe_w ?        00:00:00 courierlogger
5 S     0   640     1  0  85   0 -   871 select ?        00:00:00 couriertcpd
4 S     0   643     1  0  85   0 -   812 pipe_w ?        00:00:00 courierlogger
4 S  2522   651     1  0  76   0 -   359 select ?        00:00:00 qmail-send
4 S  2022   653   651  0  75   0 -   349 pipe_w ?        00:00:00 splogger
4 S     0   654   651  0  77   0 -   356 select ?        00:00:00 qmail-lspawn
4 S  2521   655   651  0  81   0 -   355 select ?        00:00:00 qmail-rspawn
4 S  2520   656   651  0  75   0 -   347 pipe_w ?        00:00:00 qmail-clean
5 S     0   671     1  0  78   0 -  6306 select ?        00:00:02 spamd
5 S     0   700     1  0  76   0 -  6007 select ?        00:00:01 httpd
5 S     0   731   700  0  76   0 -  5993 -      ?        00:00:00 httpd
5 S    48   732   700  1  76   0 -  8736 -      ?        00:00:27 httpd
5 S    48   733   700  0  76   0 -  9710 semtim ?        00:00:24 httpd
5 S    48   734   700  0  80   0 -  8322 semtim ?        00:00:20 httpd
5 S    48   735   700  0  75   0 -  8570 semtim ?        00:00:18 httpd
5 S    48   736   700  0  76   0 -  9839 semtim ?        00:00:24 httpd
5 S    48   737   700  0  75   0 -  8594 semtim ?        00:00:21 httpd
5 S    48   738   700  0  75   0 -  9808 semtim ?        00:00:23 httpd
5 S    48   739   700  0  75   0 -  8424 semtim ?        00:00:18 httpd
5 S     0   758     1  0  76   0 -  3256 select ?        00:00:00 httpsd
5 S  2523   762   758  0  84   0 -  3761 -      ?        00:00:05 httpsd
5 S  2523   763   758  0  84   0 -  3759 -      ?        00:00:04 httpsd
5 S  2523   764   758  0  84   0 -  4057 -      ?        00:00:04 httpsd
5 S  2523   765   758  0  84   0 -  4025 -      ?        00:00:05 httpsd
5 S  2523   766   758  0  84   0 -  4083 -      ?        00:00:05 httpsd
5 S     0   783     1  0  76   0 -   379 sysent ?        00:00:00 crond
1 S    41   807     1  0  82   0 -  2497 wait   ?        00:00:00 python
0 S    41   808   807  0  76   0 -  2503 select ?        00:00:00 python
0 S    41   809   807  0  76   0 -  2518 select ?        00:00:00 python
0 S    41   810   807  0  76   0 -  2496 select ?        00:00:00 python
0 S    41   811   807  0  76   0 -  2505 select ?        00:00:00 python
0 S    41   812   807  0  76   0 -  2570 select ?        00:00:00 python
0 S    41   813   807  0  76   0 -  2579 select ?        00:00:00 python
4 S     0   820     1  0  78   0 -   347 -      tty1     00:00:00 mingetty
4 S     0   821     1  0  78   0 -   347 -      tty2     00:00:00 mingetty
4 S     0   822     1  0  78   0 -   347 -      tty3     00:00:00 mingetty
4 S     0   823     1  0  78   0 -   347 -      tty4     00:00:00 mingetty
4 S     0   824     1  0  78   0 -   347 -      tty5     00:00:00 mingetty
4 S     0   825     1  0  83   0 -   347 -      tty6     00:00:00 mingetty
0 S    41   814   807  0  76   0 -  2502 select ?        00:00:00 python
0 S    41   826   807  0  76   0 -  2502 select ?        00:00:00 python
4 S     0   827     1  0  76   0 -   350 -      ttyS0    00:00:00 agetty
5 S  2523   850   758  0  84   0 -  3911 -      ?        00:00:04 httpsd
5 S  2523   948   758  0  76   0 -  3838 -      ?        00:00:04 httpsd
5 S  2523  1038   758  0  76   0 -  3927 -      ?        00:00:04 httpsd
5 S     0  4784   524  0  75   0 -  1830 select ?        00:00:00 sshd
4 S     0  4788  4784  0  76   0 -  1036 wait   pts/0    00:00:00 bash
4 R     0  4821  4788  0  78   0 -   552 -      pts/0    00:00:00 ps

root      4788  4784  0 09:20 pts/0    00:00:00 -bash
root      4824  4788  0 09:21 pts/0    00:00:00 ps -f

I've removed all but a few modules and the memory dropped down to an average of about 60%. I'm going to activate each module one by one and then remove unecessary ones.
Logged
MightyE
Global Moderator
Captain of the Guard
*****
Offline Offline

Posts: 104


Game Creator MIGHTYE


View Profile
« Reply #5 on: April 13, 2005, 07:34:42 AM »

try a top, and hit M (capital M, case matters) to sort by memory usage.  This'll give you an idea of what's eating your RAM.

With a PHP memory limit of 64mb, and that many modules, it might just be that a lot of them hook on, eg, everyhit, and thus have to be put the compiled code space every hit.

Also, if you have total control over the server, I highly recommend Turck MMCache, which itself also greatly increases performance.  No help here on getting that installed though, you'll have to get help on that from the MMCache guys.
Logged
Kendaer
Guest
« Reply #6 on: April 13, 2005, 07:41:48 AM »

A better way to find the memory hogging process(es) is to (at your command line) type
Code:
top

This will display, by default, a list of processes that updates over type.
Once top is running, in the window where you are running top, type 'M' (capital M).
That will sort the process list by memory used.

Also at the top of the display you will see something that looks like

Mem:   1035176k total,  1003908k used,    31268k free,   191556k buffers
Swap:  4096564k total,    18680k used,  4077884k free,   248196k cached

Those are the values from dragoncat right now.  You'll notice that it looks like system memory is full, but it's actually not.. Linux takes those free pages for itself but will release them when needed.   The useful value is swap used (which is minimal).

The process list for the moment look like

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 5007 root      15   0  327m  65m 9252 S  4.3  6.5   2953:33 X
 4359 root      16   0 54076  47m 2784 S  0.0  4.6   1:15.54 spamd
14241 jtraub    15   0  111m  46m  17m S  0.0  4.6   4:23.94 firefox-bin
 4355 root      18   0 53444  46m 2796 S  0.0  4.6   1:42.14 spamd
 4356 root      17   0 52148  45m 2784 S  0.0  4.5   1:29.14 spamd
 4357 root      17   0 51348  44m 2796 S  0.0  4.4   1:58.33 spamd
 4358 root      16   0 39176  32m 2792 S  0.0  3.2   2:20.57 spamd
 4185 mysql     16   0  123m  26m 4532 S  0.0  2.6  22:59.89 mysqld


You'll notice that mysql is pretty far down the list.   The interesting number here is the one listed under RES (or RSS).. this is how much memory is actually being used.  VIRT is how much memory + how much swap is being used.

Hope this helps you find the problem.
« Last Edit: April 13, 2005, 07:42:39 AM by Kendaer » Logged
RPGSL
Guest
« Reply #7 on: April 13, 2005, 07:44:25 AM »

I'll look into the cache code. Here is the top. I've set php.ini to 16M and it still works well.

top - 09:43:21 up  1:05,  1 user,  load average: 0.04, 0.19, 0.16
Tasks:  86 total,   1 running,  85 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.3% us,  0.0% sy,  0.0% ni, 99.7% id,  0.0% wa,  0.0% hi,  0.0% si
Mem:    508064k total,   293904k used,   214160k free,     4228k buffers
Swap:  2048248k total,        0k used,  2048248k free,   104300k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
  574 mysql     15   0  103m  29m 5608 S  0.0  6.0   0:00.22 mysqld
  671 root      18   0 25224  20m 6256 S  0.0  4.2   0:02.01 spamd
 6284 apache    20   0 32220  18m  20m S  0.0  3.7   0:05.42 httpd
 6290 apache    15   0 31952  18m  20m S  0.0  3.7   0:04.57 httpd
 6285 apache    15   0 27928  14m  20m S  0.0  2.9   0:05.07 httpd
 6291 apache    16   0 27908  14m  20m S  0.0  2.9   0:02.95 httpd
 6287 apache    16   0 27892  14m  20m S  0.0  2.9   0:02.90 httpd
 6289 apache    15   0 27848  14m  20m S  0.0  2.9   0:02.34 httpd
 6288 apache    16   0 27288  13m  20m S  0.0  2.8   0:02.80 httpd
 6286 apache    15   0 27076  13m  20m S  0.0  2.7   0:03.80 httpd
 6238 root      16   0 24028 9.8m  20m S  0.0  2.0   0:01.20 httpd
 6283 root      17   0 23972 9980  20m S  0.0  2.0   0:00.00 httpd
 5525 psaadm    24   0 17004 9748  11m S  0.0  1.9   0:02.40 httpsd
 5530 psaadm    24   0 16844 9544  11m S  0.0  1.9   0:02.08 httpsd
 5529 psaadm    24   0 15968 8684  11m S  0.0  1.7   0:02.22 httpsd
 5493 psaadm    24   0 15928 8628  11m S  0.0  1.7   0:02.53 httpsd
 4895 psaadm    25   0 15928 8620  11m S  0.0  1.7   0:02.67 httpsd
 5524 psaadm    24   0 15348 8024  11m S  0.0  1.6   0:02.08 httpsd
 5527 psaadm    24   0 15044 7708  11m S  0.0  1.5   0:01.75 httpsd
 5528 psaadm    25   0 15044 7708  11m S  0.0  1.5   0:01.80 httpsd
 5819 psaadm    24   0 15044 7708  11m S  0.0  1.5   0:01.77 httpsd
  813 mailman   16   0 10316 5540 6748 S  0.0  1.1   0:00.37 python
  812 mailman   16   0 10280 5488 6748 S  0.0  1.1   0:00.35 python
  809 mailman   16   0 10072 5460 6748 S  0.0  1.1   0:00.36 python
  810 mailman   16   0  9984 5456 6748 S  0.0  1.1   0:00.35 python
  811 mailman   16   0 10020 5456 6748 S  0.0  1.1   0:00.34 python
  814 mailman   16   0 10008 5456 6748 S  0.0  1.1   0:00.35 python
  808 mailman   16   0 10012 5452 6748 S  0.0  1.1   0:00.35 python
  826 mailman   16   0 10008 5452 6748 S  0.0  1.1   0:00.32 python
  807 mailman   22   0  9988 5448 6740 S  0.0  1.1   0:00.00 python
  758 root      16   0 13024 4936  11m S  0.0  1.0   0:00.06 httpsd
  508 named     18   0 29876 2676 4780 S  0.0  0.5   0:00.00 named
 5539 root      15   0  7480 2188 4240 S  0.0  0.4   0:00.06 sshd
 5549 root      15   0  7492 2168 4240 S  0.0  0.4   0:00.09 sshd
 4784 root      16   0  7484 2164 4240 S  0.0  0.4   0:00.12 sshd
  524 root      16   0  3660 1448 3444 S  0.0  0.3   0:00.11 sshd
 4788 root      15   0  4144 1336 3952 S  0.0  0.3   0:00.04 bash
  549 root      18   0  4136 1144 3952 S  0.0  0.2   0:00.01 safe_mysqld
 5541 root      15   0  3504 1060 3140 S  0.0  0.2   0:00.11 sftp-server

EDIT: I have uninstalled 95% of the mods to get that list. I will activate one by one after I set up the configuration and cache.
« Last Edit: April 13, 2005, 07:48:50 AM by RPGSL » Logged
MightyE
Global Moderator
Captain of the Guard
*****
Offline Offline

Posts: 104


Game Creator MIGHTYE


View Profile
« Reply #8 on: April 13, 2005, 10:34:13 AM »

Code:
Swap:  2048248k total,        0k used,  2048248k free,  104300k cached

You're not swapping at all yet, you've got room to grow even if your 'free' ram isn't low.  Like JT said, the OS will hog up memory in volatile cache pages, these pages are released as soon as some process needs more ram, they don't get moved to swap.

Having low unused RAM is not a bad sign on Linux, you only need to worry when you start dumping data into Swap.
Logged
RPGSL
Guest
« Reply #9 on: April 13, 2005, 12:56:26 PM »

I removed about 50 modules, created the tmpfs folder and enabled data caching. The page loads have sped up a ton - from about 4-5 seconds to about 1. I've set the maxclients to 25 as well. Thank you all very much for the help.

I still have about a half second delay when clicking any link in the game.

memory_limit = 20M
register_globals = On
magic_quotes = Off
output_buffering = 4086
register_argc_argv = Off
variables_order = "GPCS"

top - 15:10:23 up 29 min,  1 user,  load average: 0.06, 0.11, 0.14
Tasks:  87 total,   1 running,  86 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0% us,  0.3% sy,  0.0% ni, 99.7% id,  0.0% wa,  0.0% hi,  0.0% si
Mem:    508064k total,   347568k used,   160496k free,     4648k buffers
Swap:  2048248k total,        0k used,  2048248k free,    99732k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
  581 mysql     15   0  103m  28m 5608 S  0.0  5.8   0:00.17 mysqld
 2755 apache    17   0 38220  24m  20m S  0.0  4.9   0:06.01 httpd
 2761 apache    16   0 37908  24m  20m S  0.0  4.8   0:04.44 httpd
 2758 apache    16   0 37408  23m  20m S  0.0  4.7   0:10.65 httpd
 2759 apache    16   0 37132  23m  20m S  0.0  4.7   0:06.02 httpd
  678 root      18   0 25224  20m 6256 S  0.0  4.2   0:02.08 spamd
  691 popuser   25   0 25180  20m 6232 S  0.0  4.1   0:02.09 spamd
  689 popuser   25   0 25180  20m 6232 S  0.0  4.1   0:02.00 spamd
 2760 apache    15   0 33952  20m  20m S  0.0  4.1   0:02.94 httpd
 2756 apache    15   0 33148  19m  20m S  0.0  3.9   0:02.97 httpd
 2754 apache    15   0 33036  19m  20m S  0.0  3.9   0:02.31 httpd
 2757 apache    16   0 27508  13m  20m S  0.0  2.8   0:03.05 httpd
 2708 root      16   0 24028 9.8m  20m S  0.0  2.0   0:01.16 httpd
 2753 root      17   0 23972 9984  20m S  0.0  2.0   0:00.00 httpd
 1032 psaadm    16   0 16620 9616  11m S  0.0  1.9   0:04.33 httpsd
 3616 psaadm    18   0 15924 8456  11m S  0.0  1.7   0:00.47 httpsd
 3254 psaadm    15   0 15104 7648  11m S  0.0  1.5   0:00.76 httpsd



Any suggestions or do you think it's the modules causing the delays?

Also, I get an average high of about 25 players at once. Do you think a Celeron 2.0 with 512 can handle that kind of traffic for this game?
« Last Edit: April 13, 2005, 01:22:05 PM by RPGSL » Logged
lonnyl
Guest
« Reply #10 on: April 13, 2005, 03:57:00 PM »

Also, I get an average high of about 25 players at once. Do you think a Celeron 2.0 with 512 can handle that kind of traffic for this game?

I run a Athlon 2000+ with 384Mb ram.....  Ton's of modules..... Mandrake Linux 10.0  Turck_mmcache and HTML Compression.  With about 30 players on pagegens average about 1 second.  
Logged
MightyE
Global Moderator
Captain of the Guard
*****
Offline Offline

Posts: 104


Game Creator MIGHTYE


View Profile
« Reply #11 on: April 14, 2005, 07:42:43 AM »

It can probably handle 25 simultaneous players as long as your max clients are low enough.  

Your half second delay might be the result of PHP runtime compiling of the game core code and any injected modules.  Also, network latency could contribute significantly to that half second, it's not unusual to see 300ms latency (0.3 sec) even on very good connections, 500ms is not at all unheard of.

Again, I'll plug MMCache, the more modules you have installed, the more time the PHP engine will spend each page hit compiling those modules.  MMCache keeps a compiled version of each PHP file in RAM, and when it runs out of free RAM, keeps a compiled version on the disk.  This removes a lot of the overhead on each page hit.
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Version 1.1.2 is the current supported version and is available for download.

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
28 Guests, 1 User
aeanos
Home Forums News Downloads Login Register Advanced Search