Forum Moderators: phranque

Message Too Old, No Replies

Server become slower

         

agriz

5:18 am on Jan 9, 2012 (gmt 0)

10+ Year Member



Hi

It was working fine.
Suddenly the server is loading very slowly.

I tried to make some changes in httpd.conf
Still it is not faster.

i7 with 8gb ram.

httpd.conf

KeepAlive On
MaxKeepAliveRequests 0
KeepAliveTimeout 15

<IfModule prefork.c>
StartServers 16
MinSpareServers 15
MaxSpareServers 64
ServerLimit 256
MaxClients 256
MaxRequestsPerChild 100000
</IfModule>

my.cnf

[mysqld]

datadir=/var/lib/mysql

socket=/var/lib/mysql/mysql.sock

max_user_connections=25

max_connections=500

interactive_timeout=10

wait_timeout=10

connect_timeout=10

thread_cache_size=128

key_buffer=16M

join_buffer=1M

max_allowed_packet=16M

table_cache=1024

record_buffer=1M

sort_buffer_size=2M

read_buffer_size=2M

max_connect_errors=10# Try number of CPU's*2 for thread_concurrencythread_concurrency=8

myisam_sort_buffer_size=64M

#log-binserver-id=1

old-passwords = 1

[mysql.server]

user=mysqlbasedir=/var/lib

[safe_mysqld]

err-log=/var/log/mysqld.log

pid-file=/var/lib/mysql/mysql.pid

open_files_limit=8192

[mysqldump]

quickmax_allowed_packet=16M

[mysql]

no-auto-rehash

#safe-updates

[isamchk]

key_buffer=64M

sort_buffer=64M

read_buffer=16M

write_buffer=16M

[myisamchk]

key_buffer=64M

sort_buffer=64M

read_buffer=16M

write_buffer=16M

[mysqlhotcopy]
interactive-timeout


Home page is static. But loading of homepage itself is very slow.
I don't have much queries.
So i think it should be dealt with httpd and php.

I have also installed php acceleration (yum install php-eaccelerator)

DarkEden Genesis

7:02 am on Jan 9, 2012 (gmt 0)

10+ Year Member



You didn't showed your website so I can't see it.

I can't see any error here.
But you must enable: skip-name-resolve.
Reverse DNS resolve will always late connection.

Add this line to your my.cnf and reset httpd + mysql and try it.

Do you have bind (named) running?
Check your IP on resolv.conf.

agriz

10:51 am on Jan 9, 2012 (gmt 0)

10+ Year Member



resolv.conf have the following values


nameserver 4.2.2.2
nameserver 4.2.2.1

I have added skip-name-resolv in the end of the my.cnf
But still same. It is slow.

Yes, I have bind named running.

Frank_Rizzo

11:14 am on Jan 9, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



1. what is the output of

top

in particular what is the total swap size, and the used swap size.

2. Is this a high volume site? How many uniques a day?

3. Has this just started slowing down or has it been like this since you first had that server?

4. What is the total size of your mysql indexes?

5. Download and run this

[mysqltuner.pl...]

See what it recommends.

----

At a guess your httpd settings are over-optimised and eating up all your memory resulting in disk swapping. Your mysql settings seem under-optimised.

Unless you do have a high volume site then these figures are too high

StartServers 16
MinSpareServers 15
MaxSpareServers 64
ServerLimit 256
MaxClients 256
MaxRequestsPerChild 100000


Also look at disabling unused modules.

agriz

11:29 am on Jan 9, 2012 (gmt 0)

10+ Year Member



It became slower in the last two days only.
mysql is used very rarely.

traffic is little high in the last two days and server is having problem.

free -m


total used free shared buffers cached
Mem: 7785 4684 3101 0 26 401
-/+ buffers/cache: 4256 3529
Swap: 9951 43 9908

I think i need to optimize httpd. Not sure. Server is i7 3.4ghz and 8gn ram

agriz

11:51 am on Jan 9, 2012 (gmt 0)

10+ Year Member



i am using webmin. It is loading very fast as usual. It is just site which loads slowly.

Does it give any idea to trace the problem?

DarkEden Genesis

11:58 am on Jan 9, 2012 (gmt 0)

10+ Year Member



Since you have bind running, you can use 127.0.0.1 on resolv.conf.

agriz

12:03 pm on Jan 9, 2012 (gmt 0)

10+ Year Member



should i remove

nameserver 4.2.2.2
nameserver 4.2.2.1

?

agriz

12:04 pm on Jan 9, 2012 (gmt 0)

10+ Year Member



nameserver 127.0.0.1

is that right?

DarkEden Genesis

1:37 pm on Jan 9, 2012 (gmt 0)

10+ Year Member



yes, fine

agriz

1:49 pm on Jan 9, 2012 (gmt 0)

10+ Year Member



I did the changes as you said. It is still same :(

Frank_Rizzo

4:46 pm on Jan 9, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



When you say loading slow what does that mean?

All pages are slow in being served or just some?

Are your users saying this or is it just on your browsing device?

The swap file is very low so that's unlikely to be the problem but keep checking on it to see if it grows.

Take a look at the httpd, messages, syslog, boot log files in /var/log to see if any of the hardware is reporting faults.

agriz

4:53 pm on Jan 9, 2012 (gmt 0)

10+ Year Member



The whole site is slow. But webmin is loading is faster. How to increase swap file ?

agriz

5:16 pm on Jan 9, 2012 (gmt 0)

10+ Year Member



I just found the following in messages.

possible SYN flooding on port 80. Sending cookies.

I have csf and i have enabled CT_LIMIT = 25 and SYNFLOOD = 1
Do i need to do anything to avoid it?

Someone said i have to instal mod_qos. How to install it in centos 6?

DarkEden Genesis

5:58 pm on Jan 9, 2012 (gmt 0)

10+ Year Member



Google it.
Instead of Google, I would use my lazy and just type the obvious:

yum install mod_qos

agriz

6:01 pm on Jan 9, 2012 (gmt 0)

10+ Year Member



i tried google and the yum install already.
I didnt get much details in google :(

DarkEden Genesis

6:09 pm on Jan 9, 2012 (gmt 0)

10+ Year Member



1st Check this: [pc-freak.net...]


If don't work, then try this Centos Setup: [howtoforge.com...]


For last search here for "centos 6 setup": [howtoforge.com...]

Frank_Rizzo

6:30 pm on Jan 9, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You don't need to increase your swap. It is virtually empty, which is what you want it to be.

Swap happens when you run out of RAM and the apps then start using the hard disk to store memory. This is not a good condition so you always want your swap used value to be zero or near to it.

If it is starting to move then you are running out of RAM and you need to tune back your httpd parameters.

Take a look in Webmin, System, Running Processes, Memory.

This will show whats eating up all the RAM. You will see many entries for apache in there.

agriz

12:59 am on Jan 10, 2012 (gmt 0)

10+ Year Member



I installed mod_antiloris and waited to see how it reduces the attack.
There is no use.

I am getting that attack.
Anyway to block this attack?

DarkEden Genesis

3:14 pm on Jan 12, 2012 (gmt 0)

10+ Year Member



Are you sure you are under attack?

You can do a test.

Restart your apache server and check the page load time.
If it starts fast, but decreases as time goes by.
Then we have to look it deeper, your server can be receiving almost more requests than it can handle.

If it's the case, maybe we could think something about IPTables, to make some changes on how people access your server.

agriz

3:28 pm on Jan 12, 2012 (gmt 0)

10+ Year Member



after restarting apache, it is still same.

Many people tell it is not attack.

MaxKeepAliveRequests 1000

StartServers 16
MinSpareServers 16
MaxSpareServers 64
ServerLimit 256
MaxClients 256
MaxRequestsPerChild 4000

This is the current configuration of my httpd.conf

Do i need to make any changes in apache configuration to handle traffic.

I saw if the httpd process less than 400, it handles quickly. If it is more than 400, it took long time to load.

Is it apache or php which is slowing down the loading of site?