GitXplorerGitXplorer
l

Evented_Server

public
1 stars
0 forks
3 issues

Commits

List of commits on branch master.
Unverified
5583515e90f1772886a8f01e784a91a585851583

update the doc

lliukai committed 13 years ago
Unverified
56b6fd908b33cc72ffac4f22421b3d4607ee3f5e

correct the READ format

lliukai committed 13 years ago
Unverified
697f86d8d0989a9429f9e60b3757967f1e9f0135

correct the READ format

lliukai committed 13 years ago
Unverified
0ea22cf547501d0365a63527b9528d7651ddf71e

correct the READ format

lliukai committed 13 years ago
Unverified
7a1bacfadcaaa2e61c8c213520909699ea96eb31

correct the READ format

lliukai committed 13 years ago
Unverified
65f98d6763144cb5516ea0b1c4e2dd3ef58f1d26

exclude the cgi/ and cig-bin/ directories

lliukai committed 13 years ago

README

The README file for this repository.

Introduction

In this project, both baseline server and improved server serve the content in the "event-driven" way. The concurrency was achieved by epoll/kqueue.

Dependencies:

  • libevent: libevent is a event library that could work in different platform (for example, in Mac OS libevent it will use kqueue and in Ubuntu it will use epoll)
  • boost::filesystem: I use boost::filesystem library to deal with file system related operations.

Baseline Server

The baseline server(event-based) serve the dynamic contents via traditional CGI, that is when a new request arrives, the server will fork-exec the CGI script.

Improved Server

In the improved server, the CGI scripts are represented as shared libraries(so). Thus when a new request arrives, the server will

  1. check if the CGI script(shared library) has been loaded. If not, server will load.
  2. calls the "write_to"(all CGI scripts need to export the "write_to" function.

How to run the server

Run baseline server: make cgi

Run improved server: make so

Performance

I used the httperf to evaluate the performance. The request rate per second rate varies from 500/s~5500/s The content of requested dynamic page are the same, each page is 102 KB.

Here is the performance evaluation("I" is improved server and "B" is baseline server):

                    Error rate(B)   Error rate(I)      Net I/O(B)         Net I/O(I)     Response time(B)    Response time(I)
       500 req/s        0.0             0.0           1216.5 KB/s        2207.2   KB/s      4.9 ms              0.0 ms
      1000 req/s        0.0             0.0           2433.2 KB/s        4413.8   KB/s      10.2 ms             0.0 ms
      1500 req/s        0.0             0.0           3649.3 KB/s        5619.8   KB/s      55.4 ms             0.0 ms
      2000 req/s        7.2             0.0           3240.5 KB/s        8224.8   KB/s      127.7 ms            3.0 ms
      2500 req/s        22.0            0.0           2616.3 KB/s        10025.2  KB/s      242.2 ms            2.1 ms
      3000 req/s        34.5            0.0           2051.7 KB/s        14217.3  KB/s      442.2 ms            8.5 ms
      4500 req/s        43.5            2.5           1712.5 KB/s        18457.2  KB/s      551.4 ms            14.3 ms
      5000 req/s        57.0            6.5           1214.2 KB/s        19242.2  KB/s      741.4 ms            24.3 ms
      5500 req/s        78.0           10.5           321.2  KB/s        18791.5  KB/s      431.1 ms            41.2 ms

The "error" is all the non 2xx response or timeout.

As we can see in this figure, with smaller request amount, the baseline server has even slightly better performance. However as request rate increases its performance decays rapidly.

For the improved server, its performance is more stable, although its initial performance is slightly worse than baseline.