This is a discussion on Loadtest within the Apache Web Server forums, part of the Web Server and Related Forums category; I am writing a loadtester for our application, and I am testing against IIS/Tomcat versus Apache webserver/Tomcat. I ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I am writing a loadtester for our application, and I am testing against
IIS/Tomcat versus Apache webserver/Tomcat. I am threading connections to the webserver by opening a socket and writing to the outputstream. Socket server = ..... OutputStream toServer = server.getOutputStream(); toServer.write(request); My question is probably more on the webserver side, is this an appropriate way to handle sending requests to a webserver,by opening sockets? If I create a multi-threaded application and send 500 different requests, is this the same as 500 client browser requests, as far as the webserver is concerned? - Eric |
|
|||
|
ericwaite@gmail.com napisał(a):
> I am writing a loadtester for our application, and I am testing against > IIS/Tomcat versus Apache webserver/Tomcat. > I am threading connections to the webserver by opening a socket and > writing to the outputstream. > > Socket server = ..... > OutputStream toServer = server.getOutputStream(); > toServer.write(request); > > My question is probably more on the webserver side, is this an > appropriate way to handle sending requests to a webserver,by opening > sockets? If I create a multi-threaded application and send 500 > different requests, is this the same as 500 client browser requests, as > far as the webserver is concerned? Hello, there are many possibilities to do that. Let's look at Apache Benchmark tool ("ab" binary in Apache's bin/ directory, http://httpd.apache.org/docs/2.0/programs/ab.html): * it can "employ" multiple threads ("-c" option) simulating a number of client browsers accessing server resources at one time instead of sending sequential requests * it can use Keep-Alive HTTP option ("-k") to send requests without disconnecting the socket (if server accepts it, of course) There are also different types of threading models in Apache HTTP Server. The mpm_prefork model uses new child processes to handle incoming requests. So you'll probably get varying results when testing threaded and non-threaded servers. For example, the new experimental (used in Apache 2.2 only) mpm_event_module is said to handle incomming connections better by keeping helper-threads to do some initalization work instead of taking listening (main) thread's time. And yes, creating new threds to open sockets will cause the server to do same things as it was real browsers. Although, to better simulate real-world's browsers your tool should use Keep-Alive option sending multiple requests (1 thread == N requests, N>1) until server sends "Connection: Close" header in response (AFAIK it happens, when too much clients want to have alive connection). So, to simulate 500 real-world browsers, create 500 threads sending N requests each. N can be random number in some range. IMO, that's the best way to simulate heavy traffic on production server.. -- Pozdrawiam / Best regards Pawel Zdziarski gmail: faxepl |