How to use Apache Bench to simulate server load on a Wordpress cluster?
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to use Apache Bench to simulate server load on a Wordpress cluster?
I'm working on a clustered Wordpress site installed in the Amazon Cloud (uses ELB, EC2, RDS, S3). I'm trying to scheme up a stress test before go-live so we can see if it'll support the traffic load we want. We want to simulate "10,000 simultaneous users." I interpret that as meaning we have 10k users each clicking a page every 10 seconds or so. With that in mind, our system would need to service 60,000 page requests in one minute. I'm thinking I'll use Apache Bench and wondering a couple of things:
1) I'm wondering how many of these "users" a single machine might be able to simulate so I can determine how many machines I need for simulating load. I imagine this would depend on a variety of factors including CPU power, network connection speed, RAM, etc. Any thoughts on calculating this in an Amazon EC2 context?
2) We don't want a single computer asking for the same URL 10,000 times. Any thoughts on how to randomize page accesses? Do I need a list of all the URLS? I don't see any features of this command that permit requesting more than one url.
3) Given that I'll probably need numerous machines to simulate this kind of load, any thoughts on how to start/stop many machines efficiently?
4) Can anyone suggest a good sample command line for some beautiful graphs to wow the client?
5) What about cookies? One can apparently send the same cookie with every request, but there doesn't seem to be any capacity to accept cookies and elicit the corresponding cookie-affected behavior on the server. I.e, there are no session-savvy input values.
6) Does AB just request the file itself or would it also load all the images, css, iframes, etc. specified?
7) Any other considerations come to mind?
ab is a very useful, but very simple tool. You migth prefer to use grinder for a more life like load generation. insofar as ab goes though...
1) Loads and loads. firing a request really isn't challenging. One page loaded in a browser will probably relate to maybe 6 HTTP requests (nic css, a few images etc.) and you can easily do all 6 in parallel in 1s if you know what you want to request. That's one impatient users load for, say, 30 seconds before they click another link, so you can do another 30 users in that time without any difficulty. These things all depend on the speed of the server though, as they are queued to a given level on concurrency. If you're not page scraping and pulling links to request out of the prvious response, you should be able to just request and dump 500 concurrent users trivially, probably lots more.
2) You'd need to find them, and script them yourself. start an instance for gifs, one for file a, one for file b etc... that's pretty simple to kick off, just not using ab directly.
3... 4... 5... you know... you really can NOT use ab... use a decent thing. You are right on the multi node approach if you want that many users, and grinder uses a client server architecture, and is really quite simple to get going and seems very suitable for you.
Do you mean this grinder ? This seems like a more general-purpose tool than I had in mind and the documentation has a fairly abstract bent to it. I'll look at it some more but expect the learning curve may be a bit steep for my deadlines (Monday!).
Quote:
2) You'd need to find them, and script them yourself. start an instance for gifs, one for file a, one for file b etc... that's pretty simple to kick off, just not using ab directly.
I guess I'm a bit disappointed that some easily configured, specialized HTTP testing suite doesn't already exist. It seems simple to me:
Code:
* specify a collection of urls to be accessed randomly (or in sequence)
* specify whether to handle cookies or perhaps when to drop one's cookies (e.g., after a sequence of urls is complete)
* specify some degree of concurrency (e.g., number of threads or number of users to simulate)
* specify length of test or how many times to iterate
* application performs a boatload of http requests, asking for pages and their content assets (images, js, css)
I'll certainly be looking into grinder, and I appreciate the advice.
I may also consider scripting the launch of numerous AB processes, each requesting a single page.
Hmm, Yeah the recent java flaws have nothing at all to do with a java app. That's about browsers. No such concerns exist for an app like Grinder on a private network.
I just picked a simple test script from the library and hacked it around a bit, it was pretty simple in general.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.