|
1) Add db_close to line right before exit(1). Just making sure the db connects are freed or are in clean state for the load test.
2) This test result you would get for this is only realistic in a clean-room environment. Even if you have mysql query cache disabled, subsequent reqsults will be purely from myisam/innodb buffer and or linux buffer ram so after the first few requests, you are dealing with mysql through pure memory non disk i/o calls.
I would suggest that the scripts are run with a companion program which modifies a record in the page table once every second. This forces mysql cache flush and gives you a more accurate data on how your performance is when injected with index/cache busting write queries.
In addition, instead of pure select * from pages. You should use a more common compounded query such as select * from pages where pageid = value order by priority asc, etc.
3) Don't how it applies to C but in javascript, it is magnitudes faster to buffer output like so..
var buffer = new Array();
buffer[buffer.length] = "<html>";
buffer[buffer.length] = "</html>";
document.write(buffer.join(''));
A) one big write = faster
B) Intead of appending growing data to a string, use an dynamic array and
join the data at the end = faster
the buffer.join appends all the elements into one string separated by the separator, empty char in this case.
Not sure how to do this in C but the same concept shoudl apply to most languages.
|