473,480 Members | 1,874 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Server load too high

I am running the tagboard service on my server. Few months ago I bought
the new dedicated server with Dual Xeon 3.2 GHz and 2GB Ram.
The board is written in PHP with Mysql. Not long ago I updated the
version PHP to 5. and the problem started.

The load on the server skyrocked between 39-52. And I seriously have no
idea what to do about it.

This is remotedly hosted servise and there are number of connections
from other websites to my own. However I don't have any other working
websites on this server. Each client is connected to the database with
mysql_connect. But I do not know why there is a problem with server
load and why the database takes so much from the server resources?
Below is a sample of the Current CPU usage. As you can see the database
connection takes a lot of resources.

Pid Owner Priority Cpu % Mem % Command
7128 mysql 0 1.3 2.0 /usr/sbin/mysqld
--basedir=/ --datadir=/var/lib/mysql --user=mysql
--pid-file=/var/lib/mysql/host.yobug.com.pid --skip-locking
7112 nobody 0 0.1 0.8
/usr/local/apache/bin/httpd -DSSL

I also checked CPU/Memory/MySQL Usage and last few days I this since I
installed php version 5 the CPU % usage is almost 99-123%! The website
can't work like this.

I thought about couple of solutions but if you can help please write a
constructive response.

1. I was thinking changing the structure of the database. Since all
the posts are in one single table I thought to change it to separate
tables for each customer. Than the process of posting or writing to the
database table would be much faster since the tables would not be
locked for others and the processes don't have to wait.

2. reinstalling PHP to older version php4.

Is there any way that the problem can be solved? if Yes let me know.

Jan 6 '06 #1
3 1882
ew****@earthlink.net wrote:
I am running the tagboard service on my server. Few months ago I bought
the new dedicated server with Dual Xeon 3.2 GHz and 2GB Ram.
The board is written in PHP with Mysql. Not long ago I updated the
version PHP to 5. and the problem started.

The load on the server skyrocked between 39-52. And I seriously have no
idea what to do about it.

This is remotedly hosted servise and there are number of connections
from other websites to my own. However I don't have any other working
websites on this server. Each client is connected to the database with
mysql_connect. But I do not know why there is a problem with server
load and why the database takes so much from the server resources?
Below is a sample of the Current CPU usage. As you can see the database
connection takes a lot of resources.

Pid Owner Priority Cpu % Mem % Command
7128 mysql 0 1.3 2.0 /usr/sbin/mysqld
--basedir=/ --datadir=/var/lib/mysql --user=mysql
--pid-file=/var/lib/mysql/host.yobug.com.pid --skip-locking
7112 nobody 0 0.1 0.8
/usr/local/apache/bin/httpd -DSSL
Hi,

That looks like mySQL is doing all the numbercrunching here indeed.


I also checked CPU/Memory/MySQL Usage and last few days I this since I
installed php version 5 the CPU % usage is almost 99-123%! The website
can't work like this.
I am suprised that php5 is the reason for this.
I suspect you better have a look at the SQL and database.
PHP5 has a better performance than php4. (So they claim)

I thought about couple of solutions but if you can help please write a
constructive response.

1. I was thinking changing the structure of the database. Since all
the posts are in one single table I thought to change it to separate
tables for each customer. Than the process of posting or writing to the
database table would be much faster since the tables would not be
locked for others and the processes don't have to wait.
Do you expect that the WHOLE table is locked?
I would think that a rowlock would be enough... But then again, I do not
know the SQL and the databasedesign.

But making a seperate table for each customer sound crazy.

I think you better add a few smart indexes on the table.

eg: If all your queries use a datecolumn in the WHERE-clause, index that
column.

You might want to do some profiling first, to find out what is taking up all
the time.

2. reinstalling PHP to older version php4.
I don't think PHP is the reason for the delay, unless you somehow also
installed inferiour mySQL drivers. But my knowledge of mySQL is close to
zero, so check this out yourself.

Is there any way that the problem can be solved? if Yes let me know.


1) Look at your queries, can you add some indexes?
2) Is your mySQL driver OK? (ask somebody else than me)

If you decide to switch back to PHP4, please tell us what you find.
I would be surprised if PHP5 is the one giving troubles here and would like
to know. Ok?

Good luck.

Regards,
Erwin Moller
Jan 6 '06 #2
If you do switch back to php 4, before you do just check and see what
table types you are using. It is myisam or innodb?

If it is myisam and there are lots of writes occurring on the table it
will preform a table lock on each write, you maybe better off switching
to innodb and row locking.

Also switch to using mysql_pconnect.

Jan 7 '06 #3
ew****@earthlink.net wrote:
I am running the tagboard service on my server. Few months ago I bought
the new dedicated server with Dual Xeon 3.2 GHz and 2GB Ram.
The board is written in PHP with Mysql. Not long ago I updated the
version PHP to 5. and the problem started.

The load on the server skyrocked between 39-52. And I seriously have no
idea what to do about it.

[snip]

Well, since it looks like MySQL is eating more of the CPU, it could be
part of the equation. I'm not entirely certain of all of the
differences between the PHP 4.x and PHP 5.x, but it is entirely possible
by that upgrading, you may have found a design error in the application
or database arrangement.

My inclination would be to see what version of MySQL you're using, check
that against the MySQL client library that PHP5 is using, and see if
you're using the mysql or mysqli extensions for PHP. If you're using
mysql.so and you're using a newer version of MySQL, consider switching
to the mysqli.so extension.

Also, as stated earlier by someone else, check to see what the queries
are doing.

Your load average may have jumped, also, if the way processes are
spawned changed between the releases, but I'm not sure if that's
something to do with PHP at all, so that could be totally wrong.

In any case, I've been using PHP5 for a while now, and I've not
encountered any bugs of this sort caused by valid code... although one
thing that I haven't really done yet is work with PHP4 object code on
PHP5, since I find PHP5 objects better. Do you use PHP4 objects? Maybe
you can try to isolate the behavior better somewhere, if you have the
chance to play in a test environment and try to isolate the cause.

Later,
Mike
Jan 7 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
2840
by: Justin Lazanowski | last post by:
Cross posting this question on the recommendation of an I have a .NET application that I am developing in C# I am loading information in from a dataset, and then pushing the dataset to a grid,...
4
5255
by: Gary Davis | last post by:
Once a day or so, I receive an error on a fairly active website that calls this StrMixed.cs method constructor. 99% of the time there is no exception: System.Web.HttpUnhandledException:...
1
1650
by: thomasamillergoogle | last post by:
I have a site that sometimes gets extremely high server loads. I would like to make it so if the sustained server load is very high (million page views per hour) then it will switch to text only...
10
2331
by: Fabuloussites | last post by:
I'm considering deploying an application that will us an IP address locaiton database provided by Ip2location.com... http://www.ip2location.net/ip2location-dotnet-component.aspx their .net...
7
25699
by: Vincent Delporte | last post by:
Hello I'm interested in hearing reflections by seasoned web app developpers about the different ways to write PHP apps, and especially how they compare in terms of performance, whether it's the...
1
2531
by: Michael | last post by:
Hello, I am trying to develop a database solution for an organisation in Indonesia. This organization has a number of offices and users throughout the country. They all need to maintain their...
4
2823
by: Ronald Green | last post by:
Hi, I have this theoretical problem: Say that I need a chat server that also has a database where it saves all conversations. However, I need several servers for availability and load balancing....
11
4672
by: Max Vit | last post by:
I have deployed few Access apps splitting it in Front End and Back End. Our environment uses Win XP SP2 for clients, Win 2k3 for servers and Access 2003. The max. number of clients is about 50...
0
2629
by: nichele | last post by:
Hi All, I would like to ask to you, how many connections a db server can handle. I know the question is not so easy, and actually I don't want to known a "number" but something like: - up to 100...
0
7046
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6908
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7048
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7088
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6741
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6956
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4783
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4485
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
563
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.