Jump to content
Sign in to follow this  
alexnofue

Slow web site after migration

Recommended Posts

Hi, I have a problem with a web site migrated from a linux (php, apache, mysql) server to a windows (php, iis, sql server 2008) server, the page is terribly slow after the migration; I know IIS is slower than apache for php.Any advice in what to check for?Any pointers will be very welcome.

Share this post


Link to post
Share on other sites

That is quite a change. First, you need to eliminate certain variables. Like, most notably, the environment. Is this on the same server or network? Was this migration internal to external or vice versa? That is where I would start.From there, I would look at the SQL scripts - converting them from MySQL to MS SQL could have introduced several changes - especially if you're talking about store procedures and views.But, in general, for what you describe, here is the order to analyze the changes in:1.) location2.) hardware3.) software4.) programmingIn this order, determine what has changed and if that could have made a difference based on what is known about the respective advantages and disadvantages of the products being compared.Hope that helps.

Share this post


Link to post
Share on other sites

What is the page doing? Is it particularly database-intensive? Was the server set up by a professional, is it using FastCGI?

Share this post


Link to post
Share on other sites

Thanks for your almost instant response.ok, more details, is in a windows 2003 server, that means IIS 6, with fastcgi.the database is in a separated server but in the same network/lan, sql server 2008.the page is somewhat database intensive as all content and structure come from it.the queries where simple after loosing all the "limit" and similar, no stored procedures.

Share this post


Link to post
Share on other sites
Thanks for your almost instant response.ok, more details, is in a windows 2003 server, that means IIS 6, with fastcgi.the database is in a separated server but in the same network/lan, sql server 2008.the page is somewhat database intensive as all content and structure come from it.the queries where simple after loosing all the "limit" and similar, no stored procedures.
That information does help, but it still leaves the finer (more important) details out. You seem to be describing what your set up is now. What was it before. I understand the operating system has changed, was the database on a separate sever before? Was MS SQL installed on the old MySQL server before? If you removed the "LIMIT" restriction from your queries, did you replace them with "TOP"?Without these answers, I could speculate your slow down could come from a server that once only had MySQL installed and now has MS SQL on it as well - hogging/consuming more resources.ORIt could be as simple as removing LIMIT. There would be a big difference in PHP outping everything a query returned if the query had a LIMIT 10 versus an unlimited query return 10,000 record and PHP capping the display to 10.These are the types of analysis you need to dig into if you really want to get to the bottom of this.Location, hardware, software, code.:-)

Share this post


Link to post
Share on other sites

Another thing to check is the link between the two servers. What kind of network is between them? In terms of checking the code itself (or looking for symptoms), you can pick a particularly slow script and add some timing to it to figure out exactly how long the different parts are taking. Though I bet you'll find out that the database is taking all of the time. Do you know the specs on the database server? We just had a server online recently which had 2 older 7200 RPM SATA drives, 2 dual-core Xeons, and 8GB of RAM and the thing got absolutely brought to its knees (as in the CPU load at four times capacity) by only a few thousand users because of the hard drive performance. The CPU couldn't finish anything because it was waiting on the disks to finish their I/O for the database. Hard drive performance is definitely something not to overlook. If you find that the problem is with the database server, look at the throughput of the network between the two servers, and look at the server itself to see if it's able to keep up. Maybe write some tests that use the database and compare the performance on the old and new servers to see how fast it should be running compared to how fast it is.

Share this post


Link to post
Share on other sites

Your right Skemcin, it was in the same server ( let's say server 1, had page, db) and now is in server 2 (page) and server 3 (db).The queries were "translated" as some other things didn't work, but still posibly slow.As you pointed before, i might have to check hardware, is there a way to check how fast/slow is the network?

Share this post


Link to post
Share on other sites

Thanks Justsomeguy for your response, if i build a test, let's say a queryselect top 1000 * from biggest_tablehow can i pinpoint the slow part? comparing with the old server (i can).would it be a good test plan to compare a non-query script and then a query script to see.maybe using some microtime() or how do i test?Edit: checking links

Edited by alexnofue

Share this post


Link to post
Share on other sites
Your right Skemcin, it was in the same server ( let's say server 1, had page, db) and now is in server 2 (page) and server 3 (db).The queries were "translated" as some other things didn't work, but still posibly slow.As you pointed before, i might have to check hardware, is there a way to check how fast/slow is the network?
This could be the right direction. Is the web server and the database server used to be on the same server (hardware/box) and they are not separated - then I would look there first. Test your network connection between each box and ake sure your new box (the new database server) is built correctly, i.e. enough memory and processing power and not being bogged down by something else.Tackling all that, would address the location and hardware aspects of my advice. From there, it is software and programming.Nothing else has been introduced into these environments? Is this correct . . . OLDBox A - Apache, PHP, MySQLNEWBox B - Windows/IIS, PHPBox C - MS SQL

Share this post


Link to post
Share on other sites
maybe using some microtime() or how do i test?
In terms of PHP, yeah you can use microtime to keep track of how long things are taking. SQL Server also comes with some pretty good tools, if you have the full version you can use the profiler to figure out which queries are taking the longest, and it will also suggest indexes and things you can add to improve the speed based on the workload it's seen. So you can set the profiler up, use the application like you normally would, then look at the profile to see what it says about things like the number of queries, the time taken, tables used, fields selected by, etc, and see suggestions about indexes you can add to speed up those particular queries.

Share this post


Link to post
Share on other sites

OK, i checked the network with justsomeguy's suggestion PCATTCP, i got 104865 KB / sec between BOX B and BOX C (the new servers), so i don't think is network problem.Checking sql server's profiler i got a query SELECT MAX(date3) as max FROM categoryusing 16% of CPU, this could be a problem, the table is under 50K records.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...