Date: Sun, 16 Nov 2003 18:14:04 -0600 (CST) From: Ryan Thompson <ryan@sasknow.com> To: Zhang Weiwu <weiwuzhang@hotmail.com> Cc: freebsd-questions@freebsd.org Subject: Re: seperating SQL and application server? Message-ID: <20031116180002.Q10305-100000@ren.sasknow.com> In-Reply-To: <3FB77AC0.7040704@hotmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Zhang Weiwu wrote to freebsd-questions@freebsd.org: > Hello. I am running apache + php + mysql on an PIII 800MHz server. > Phpgroupware webpages takes several seconds to show up on a LAN (15 > seconds at max). I mean each webpage takes several seconds to show up, > even if I am the only user to access the server, and the server have no > other works to do. > > I wish to know what slowed it down. A static page is 10 times faster. I > know phpgroupware is very complicated, and each page are displayed after > complicated process, so is the CPU too slow? Or is it the I/O problem? > Or should I put the SQL server on another box? What is likely to be the > slowest part? As others have mentioned, running vmstat is a good way to get some idea of where the bottleneck is. Also, you didn't say anything about RAM; some web applications eat RAM for breakfast, especially if they cause a lot of memory-intensive SQL queries like cross products and big joins. Run top -ores while making a few queries to the web site, and look for big http memory images. Also, if you have a significant amount of swap in use (i.e., more than 5%), that's a sign that the server has started paging, and that can slow things down by orders of magnitude. Make sure you're using mod_php instead of the standalone PHP CGI executable. This will save RAM *and* give you incredible performance gains, especially with respect to load time, and the benefits associated with SQL connection and query caching, which I hope phpgroupware takes advantage of. If you learn nothing this way, and think phpgroupware might be the problem itself, you might want to try some smaller examples of PHP and profile those... turn off output buffering, and create a small PHP application that writes incremental progress to the browser (or, write timestamps to a local logfile, although this will add to the request time and affect your results slightly), so you can see which components of the application-layer processing take the most time. Then you can work on optimizing. > I have a very old Pentium 200 box (compaq deskpro, years old but very > good quanlity), if I let it run mysql server for phpgroupware, would > it bring up the speed or actually slow it down? Separating MySQL and Apache is usually a good idea, but benefits usually only appear when both are under some load. I don't think load is your issue, especially if the server can't handle one concurrent request in a reasonable amount of time. Hope this helps, - Ryan -- Ryan Thompson <ryan@sasknow.com> SaskNow Technologies - http://www.sasknow.com 901-1st Avenue North - Saskatoon, SK - S7K 1Y4 Tel: 306-664-3600 Fax: 306-244-7037 Saskatoon Toll-Free: 877-727-5669 (877-SASKNOW) North America
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031116180002.Q10305-100000>