Академический Документы
Профессиональный Документы
Культура Документы
The object of this research is to analyze the performance and reliability of an HTTP server implemented in C++ under a variety of stressing conditions to determine the number of worker threads at which performance is optimal, and in every case to compare performance to Apache HTTP Servers out-of-the-box performance. Four different servers are referred to throughout this analysis: ApacheApache version 2.2.22; the version of Apache included on Linux lab machines. 10 ThreadsC++ HTTP server configured to run with 10 worker threads. 20 ThreadsC++ HTTP server configured to run with 20 worker threads. 50 ThreadsC++ HTTP server configured to run with 50 worker threads. The source code for the C++ HTTP server can be found at https://github.com/trevordixon/CS360/tree/master/Basic Server/Basic Server. Apache JMeter was used to generate test stress load on the servers and record performance data.
It will be shown that under the conditions tested, the C++ web server is both efficient and reliable. In general, performance is not significantly different from Apache, but under high stress, the C++ web server performs considerably better.
Experiment
Setup
Two
machines
were
used
in
the
experimentone
to
run
the
web
servers
under
load,
and
another
to
run
generate
the
load
and
record
data.
Servers Configuration
On
the
first
machine,
four
different
web
servers
were
running.
Apache
listened
on
port
8100.
The
following
minimal
httpd.conf
configuration
file
was
used:
Listen 8100 User apache Group apache ErrorLog /users/guest/t/tdixon2/Downloads/error.log PidFile /users/guest/t/tdixon2/Downloads/httpd.pid DocumentRoot "/users/guest/t/tdixon2/CS360/Basic Server/Basic Server/
An instance of the C++ web server was configured to run with 10 worker threads and listened on port 8110. Another instance was configured to use 20 worker threads and listened on port 8120, and another used 50 worker threads and listened on port 8150.
JMeter Configuration
One thread group was configured to simulate ${USERS} (as set in the user-defined variables) number of users, and each thread made as many requests as needed so that each test file was request 10,000 times from each server.
The
test
plan
was
run
three
times.
The
first
time,
the
thread
group
used
50
threads
to
simulate
50
concurrent
users;
next
200
users
were
simulated;
and
finally,
the
test
was
run
with
500
threads.
The
data
was
munged
into
the
following
format
for
analysis:
Timestamp,Elapsed,Request Type,Response Code,Response Message,Thread Name,Response Type,Success,Size,Port,File,Latency,Concurrent Users 1360869106970,59,HTTP Request,200,OK,Thread Group 1-2,text,true,1005102,Apache,huge.txt,3,50 1360869106970,70,HTTP Request,200,OK,Thread Group 1-3,text,true,1005102,Apache,medium.txt,3,500 1360869106970,67,HTTP Request,200,OK,Thread Group 1-1,text,true,1005102,Apache,large.txt,3,200 1360869106971,64,HTTP Request,200,OK,Thread Group 1-4,text,true,1005102,Apache,huge.txt,2,50
Results
This is true for any file size, but as the number of concurrent users increases, latency increases much more for the 10-threaded server than it does for the 20- or 50- threaded servers.
Although there is no difference in performance when using 50 worker threads instead of 20, more memory is consumed by those extra workers.
But such isnt always the case; there are a few scenarios in which Apache performs slightly better. In no case did the 10-threaded C++ server outperform any other server. Apache wins for small files and few users. Apache excels when serving small to mid-sized files to few concurrent users. For 52 KB and 300 KB files served to 50 and 200 concurrent users, Apache is a little bit faster.
The C++ server wins big time for many concurrent users.
With 500 concurrent users, Apaches latency increases substantially, and as file size increases, the C++ server catches up to Apaches transfer rate.
Conclusions
One of two scenarios is true: 1. The C++ web server has slightly more time overhead per request, but substantially less resource overhead, meaning it can scale to handle many more requests at a time. 2. Apache is configured by default to use too few worker threads to handle 500 concurrent users, so, like the 10-threaded C++ server, it struggles to keep up with the growing queue. It would be interesting to further study Apaches performance as the number of worker threads changes. It would also be interesting to see if C++ web servers request handling could be optimized to compete with Apaches latency for few users.