Training, Open Source computer languages

PerlPHPPythonMySQLhttpd / TomcatTclRubyJavaC and C++LinuxCSS

Search our site for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
A story about benchmarking PHP
I've noticed recently that the response speed of this website hasn't been as brisk as I would have liked, and thought that the cause was a steady growth in the amount of code we run behind the scenes on each page - elements I particularly felt were culprits were identifying visitors to a country by their IP addresses, and the background booking system which I hope will be live within the next few months. Plans for these next few days included a couple of hours to look at each of these areas of concern and see if I could save a few cycles here and there, add in some caches, etc.

But then I have noticed that the occasional page that wasn't going through these areas was also running a little slower, and I started to investigate. The host we're using is a shared server and I have shell login ... and a few uses of the uptime command convinced me that all was not as it should be; there seemed always to be more work that the c.p.u. could handle, and a similar test run on an identical machine on which I look after another site did not show similar overloading. So perhaps something to have a word with my ISP about?

This is one of those cautionary Christmas tales!. One last check before I wrote an "oy - what's going on" type email to the ISP ... I added in a series of 30 calls to PHP's microtime function splattered throughout a sample page, saved them in an array and dumped them out at the end of the page (I don't expect anyone but me saw them - I can't imagine that may people will be looking for the printable form of the Tk course description this morning! And what did I find? That the elements I has suspected were only taking a few milliseconds; the real culprit was a MySQL database enquiry that searched 3 million records on a non-indexed field!. Solution - short term - clean up that table that, frankly, has a lot of old crud in it. Then add an index!!

And a 2 reminder lessons - firstly not to make assumptions, and secondly of just how useful a relatively crude tool like microtime can be!

You can click on that tk course link above if you like - it'll reveal out stats at the bottom. But you shouldn't see a jump of 5 seconds between stages 15 and 16 like I did this morning!





(written 2007-12-23 13:31:07)

 
Associated topics are indexed under
H115 - Designing PHP-Based Solutions: Best Practice
H117 - Security in PHP

Back to
The Christmas Letter
Previous and next
or
Horse's mouth home
Forward to
What have hotels and bananas got in common?

Some other Articles
Does anyone understand Lithuanian?
Copyright and theft of images, bandwidth and members.
A christmas message
What have hotels and bananas got in common?
A story about benchmarking PHP
The Christmas Letter
Next course - 7th January 2008, Regular Expressions
FSB leaves its members feeling like mushrooms
Some new C programming examples - files, structs, unions etc
Decisions - small ones, or big ones?
1707 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35 at 50 posts per page


This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

© WELL HOUSE CONSULTANTS LTD., 2008: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 0800 043 8225 or 01225 708225 • FAX: 0845 8382 405 or 01225 707126 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho