views:

514

answers:

4

I'm developing a web app that will access and work with large amounts of data in a MySQL database, something like a dictionary/thesaurus. I need to test the performance of the DB as its size increases, so I know how slow each request will be in the future.

Any ideas? Like are there specific tools to check DB performance for a particular query, etc?

A: 

I was thinking of hosting my web app locally, then creating a gigantic database on my HDD, and doing a FireBug speed test to see how long my PHP web app takes to get the data into a webpage. Since its locally hosted, MySQL would be the only bottleneck, not PHP processing / server>client transfer speeds.

Would this speed test be accurate/workable? How large should my offline DB be in order to see some performance drop?

Jenko
Locally, meaning your personal computer? Especially if this is a laptop, the disk IO is not going to be anywhere near what you would see on a server. You would probably see slower query response just due to the disks being a bottleneck. You can mitigate this by making sure you allocate a lot of memory for MySQL and throwing out the first few measurements as warmup to get things into memory from disk.Keep in mind that Firebug timing may or may not be accurate. You may be better off looking at explain plans in the DB. You could also put timing code in PHP around db calls.
AngerClown
@Jeremy Rudd: What is this? It's not an answer. It seems to be more of your question. Please update your question with this additional material. Since this is NOT an answer, please delete it.
S.Lott
Performances don't only rely on database content, but also on database design. A good design can handle more requests with the same resources and dataset than a bad design.
Philippe
@AngerClown: Your comment sounds like an answer. Please post it as a separate answer, not a comment to this non-answer.
S.Lott
"allocate a lot of memory for MySQL" -- How do I do this in Windows XP?
Jenko
By database design, do you mean the schema? Or simple what tables are used and how.
Jenko
@Jeremy Rudd : Yes, I'm talking about the schema. And don't forget foreign keys and indexes ;-)
Philippe
+1  A: 

You can use Maatkit's query profiler to measure impact of data amount on MySQL performances.

And generatedata.com to generate the data you need to test your app.

You can also test your application responsiveness using HTTP testing tools like :

Philippe
Would JMeter work with a locally hosted web app?
Jenko
I don't see anything that could prevent people using JMeter on localhost.
Philippe
Seems like the definitive answer until we hear of better methods.
Jenko
+1  A: 

a good tool to use is apache's ab, which comes standard with apache httpd server. this tool can make multiple connections to a web server and benchmark its performance. while firebug is a good way to see in what order things lod, how long each item takes to load, etc., you're only seeing one user's experience. against an unloaded test server, that information can only take you so far. ab simulate multiple users connecting and will give a more realistic picture of how a particular page handles concurrent users.

which leads to me a limitation in ab: it only tests one URL. i get around this often by whipping up a simple test webpage that makes a random selection from a list of pre-defined URL's that i want to test. for example: the login page, a search result, posting a comment, and so on. ab hits the test page, and the test page simply calls one of the test URL's (possibly with a randomized paramter) and returns that page. in this manner, you get a better idea of how your whole site handles concurrent users.

PS: your OS is unanswerable. you'll have to figure that out yourself based on how your application is written, the layout of your data, the configuraiton of the web server and the database server, etc.

longneck
+1  A: 

Do you know what, specifically you're testing? Measuring "performance" is almsot always useless, unless you know exactly what it is you want.

For example, are you looking for low latency on query result retrieval? Perhaps high throughput on date retrieval? Perhaps you care more about fast insertions into the database, and less about fast query results? Perhaps you care about different things on different tables (in fact, that's almost always the case).

My advice will probably be ignored, but I'll say it anyway:

Don't optimise before you know what you want.

Don't optimise as you write the code.

When you do get around to optimising your database, make sure you optimise for the right things. Use realistic data - if you're testing dictionary-sized hunks of text, don't test with binary data (for example).

Anyway, I realise you were probably looking for a more technical answer, but hey...

Thomi
Helpful anyways... and as I said before, "so I know how slow each request will be in the future"
Jenko
but again - what does "slow" mean in this context? Are you measuring latency or throughput? Anyway, good luck with the testing!
Thomi
Latency in terms of how long it takes to execute all the queries required to generate a dynamic webpage? I'm basically talking about heavy visitor load on a DB server ... and how much total time each webpage will take to be *generated*
Jenko
I started off with the assumption that MySQL will be the bottleneck, which is why I'm not worried about measuring the PHP part.
Jenko