| View previous topic :: View next topic |
| Author |
Message |
Paul
CastleCops Founder
 Joined: Feb 22, 2002 Posts: 27351
|
Posted: Sun Feb 17, 2008 3:53 pm Post subject: Optimizing Performance |
|
|
tembow had an idea to open up discussions with those interested in the community to explore ideas in optimizing the www.castlecops.com performance.
Obviously some questions will be asked, so here are some basics...
All the deamons are the latest version for PHP, Apache and MySQL (5.2.5, 2.2.8, 5.1.22rc-log respectively).
Obviously we'll probably be revealing information that I may not be comfortable with. That can give criminals a look into our environment. But, I figure lets take a chance.
Let the questions/suggestions begin, and hopefully we'll reach a positive conclusion. I appreciate the help folks volunteer here.
|
|
| Back to top |
|
 |
Paul
CastleCops Founder
 Joined: Feb 22, 2002 Posts: 27351
|
Posted: Sun Feb 17, 2008 4:31 pm Post subject: |
|
|
One item that deserves mention:
- Most of the static files have been moved to another server and daemon (lighttpd) to reduce main site load. However, the IRT snapshots have always resided on yet another system and daemon (thttpd).
In the meantime, a good read:
http://goddess-gate.com/dc2/index.php/post/255
|
|
| Back to top |
|
 |
Cudni
Special Response Team
 Joined: Dec 10, 2002 Posts: 3718 Location: Et In Arcadia ego
|
Posted: Sun Feb 17, 2008 5:40 pm Post subject: |
|
|
Do you have any suspicions what could have happened, what changes have been made recently, that caused this slowdown?
83ppm 27.712s (15.736s) to post
72ppm 45.572s (45.015s) to redisplay
Cudni _________________ Hecho en Mexico
|
|
| Back to top |
|
 |
Tigger93
1st Responder
 Joined: Mar 18, 2007 Posts: 40 Location: USA
|
Posted: Sun Feb 17, 2008 5:45 pm Post subject: |
|
|
While I'm not sure if this would even help, perhaps consider updating the forum software, such as to phpBB version 3 (or is this phpBB 3) or IPB?
Dunno if it would help though, just a thought.
|
|
| Back to top |
|
 |
Gena01
Trooper

 Joined: Jun 07, 2007 Posts: 14 Location: USA
|
Posted: Sun Feb 17, 2008 5:48 pm Post subject: Some performance tips |
|
|
Just noticed this thread and it's actually related to a recent blog entry I posted recently: http://www.gena01.com/forum/gena01_blog/performance_tips_apc_vs_eaccelerator-t201.0.html
To add a couple of things:
1. Install Eaccelerator or APC or any other PHP caching extension. This is a must. This will save PHP script recomplication time per request. Also if you are using eaccelerator you can increase the shared memory size (if you have enough memory on the server). This will greatly improve things as they will be cached in memory and not re-read from disk.
2. I just did a quick YSlow check and it gave the post reply page a D 65 score. The most common and probably the easiest thing to fix is adding Expires header that sticks for a number of days to the images and CSS. I am not sure how to do this for other web servers but in apache you can enable mod_expires and set the expiration in either .htaccess file or in the global apache config by content-type.
These are just some quick tips since I don't know the website details or the technology and server specs on the back-end.
Thank you,
Gena01
|
|
| Back to top |
|
 |
Paul
CastleCops Founder
 Joined: Feb 22, 2002 Posts: 27351
|
Posted: Sun Feb 17, 2008 5:51 pm Post subject: |
|
|
[quote="Cudni"]Do you have any suspicions what could have happened, what changes have been made recently, that caused this slowdown?[quote]
Sounds like a silver bullet question, but unfortunately the answer isn't one.
- Squid removed
- OS upgraded
- Daemons all upgraded
I've disabled services and loads really haven't changed.
|
|
| Back to top |
|
 |
Paul
CastleCops Founder
 Joined: Feb 22, 2002 Posts: 27351
|
Posted: Sun Feb 17, 2008 6:01 pm Post subject: Re: Some performance tips |
|
|
Thanks, I"ll check into it.
| Quote: | To add a couple of things:
1. Install Eaccelerator or APC or any other PHP caching extension. This is a must. This will save PHP script recomplication time per request. Also if you are using eaccelerator you can increase the shared memory size (if you have enough memory on the server). This will greatly improve things as they will be cached in memory and not re-read from disk. |
I used to run the zend platform system but that gave barely an increase in speed. Its hard to implement such tech here across the site for all PHP files. I had to cache certain code routines instead.
| Quote: | | 2. I just did a quick YSlow check and it gave the post reply page a D 65 score. The most common and probably the easiest thing to fix is adding Expires header that sticks for a number of days to the images and CSS. I am not sure how to do this for other web servers but in apache you can enable mod_expires and set the expiration in either .htaccess file or in the global apache config by content-type. | Most of the images and css reside on the lighttpd server, so its non-impacting on the www.castlecops.com apache server. All those files are served from elsewhere. So that shouldn't be a negative perf contributor.
|
|
| Back to top |
|
 |
Paul
CastleCops Founder
 Joined: Feb 22, 2002 Posts: 27351
|
|
| Back to top |
|
 |
Gena01
Trooper

 Joined: Jun 07, 2007 Posts: 14 Location: USA
|
Posted: Sun Feb 17, 2008 6:25 pm Post subject: Re: Some performance tips |
|
|
For webpages there are two factors that result in slow performance:
1. Long running scripts on the server which delay loading of HTML.
2. Lots of content that needs to get downloaded by the browser. The less HTTP requests that are made the faster things show up.
I found this thread with a quick google search: http://www.phpbb.com/community/viewtopic.php?t=135383
Some ideas that could work:
1. Check if phpBB supports caching. I know some boards will detect if APC or Eaccelerator is installed and will integrate with it to cache things a bit better. I know SMF has a whole section that allows me to control how much caching is going to be done.
2. There could be some things database related and since I don't know where the bottleneck is it's hard to say. If you are using MySQL enable slow query log and see which queries are causing the problems.
3. This has been mentioned in the SMF support forum related to MySQL specifically in this thread: http://www.simplemachines.org/community/index.php?topic=50217.0
It mentions that if you are using MyISAM tables and there's lots of concurrent users and posts happening it could help to convert tables to InnoDB.
Good luck.
Gena01
|
|
| Back to top |
|
 |
Paul
CastleCops Founder
 Joined: Feb 22, 2002 Posts: 27351
|
Posted: Sun Feb 17, 2008 6:55 pm Post subject: Re: Some performance tips |
|
|
| Gena01 wrote: | For webpages there are two factors that result in slow performance:
1. Long running scripts on the server which delay loading of HTML.
| I concur on these. Last I checked the web portion is anywhere between 100 and 250 sql queries per second.
Indeed something I too have read in the past, but perhaps its overdue for a revisit.
| Quote: | Some ideas that could work:
1. Check if phpBB supports caching. I know some boards will detect if APC or Eaccelerator is installed and will integrate with it to cache things a bit better. I know SMF has a whole section that allows me to control how much caching is going to be done. | No this version does not. If we do an 'upgrade' I'd prefer to use something other than.
| Quote: | | 2. There could be some things database related and since I don't know where the bottleneck is it's hard to say. If you are using MySQL enable slow query log and see which queries are causing the problems. | Again statistically the percentage of slow to total is 0%.
| Quote: | 3. This has been mentioned in the SMF support forum related to MySQL specifically in this thread: http://www.simplemachines.org/community/index.php?topic=50217.0
It mentions that if you are using MyISAM tables and there's lots of concurrent users and posts happening it could help to convert tables to InnoDB. |
Worth looking into, and something that I've checked into over time. Typically we are a high percentage read versus write driven. Last I checked after a couple days mysqld uptime, I believe the read was > 90%. Right now with ~13 minutes uptime we're at 68% read.
FYI for folks reading this thread, in the hopes it'll help others too, this is a good utility:
http://mysqltuner.com/
Some stats, which under 24 hours really won't matter:
[OK] Slow queries: 0% (58/112K)
[OK] Key buffer hit rate: 99.8%
[OK] Query cache efficiency: 69.6%
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 1%
[OK] Temporary tables created on disk: 5%
[OK] Thread cache hit rate: 97%
[OK] Table cache hit rate: 98%
[OK] Open file limit used: 8%
[OK] Table locks acquired immediately: 97%
I lowered some of the buffers to 4M. Key buffer comes in at 1G. When I increase the sort, this is more apt:
[OK] Sorts requiring temporary tables: 0%
[OK] Temporary tables created on disk: 2%
|
|
| Back to top |
|
 |
Gena01
Trooper

 Joined: Jun 07, 2007 Posts: 14 Location: USA
|
Posted: Sun Feb 17, 2008 7:13 pm Post subject: |
|
|
Using InnoDB should not impact read times. It wil also help with the writing. Overall table level locks are a very very bad thing.
There are also a number of other great mysql tools:
1. MyTop - MySQL Top script
2. MySQL Report -- this one I used before and it has very nice reporting functionality that can optionally provide even more details.
In one of the replies to the blog post above I posted a link to some slides that cover MySQL performance and tuning.
Gena01
|
|
| Back to top |
|
 |
Gena01
Trooper

 Joined: Jun 07, 2007 Posts: 14 Location: USA
|
|
| Back to top |
|
 |
Paul
CastleCops Founder
 Joined: Feb 22, 2002 Posts: 27351
|
Posted: Sun Feb 17, 2008 7:43 pm Post subject: |
|
|
I've been using mytop for a while, very nice tool indeed instead of having to use show full processlist, etc.
Running it now.
As for innodb, I don't recall what the loss is over myisam. I'll go fish for that mysql dev link. _________________ Paul Laudanski - http://www.laudanski.com
http://www.linkedin.com/pub/1/49a/17b
|
|
| Back to top |
|
 |
Gena01
Trooper

 Joined: Jun 07, 2007 Posts: 14 Location: USA
|
|
| Back to top |
|
 |
Paul
CastleCops Founder
 Joined: Feb 22, 2002 Posts: 27351
|