GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - wangtechservices/tinyhttpd: tinyhttpd is a minimum functional HTTP server with epoll & non-blocking I/O & threadpool programming model

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

72 Commits
72 Commits

Folders and files

NameName
Last commit message
Last commit date
cgi-bin
cgi-bin
 
 
doc
doc
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
CMakeLists.txt
CMakeLists.txt
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
debug.h
debug.h
 
 
error.h
error.h
 
 
http_epoll.c
http_epoll.c
 
 
http_epoll.h
http_epoll.h
 
 
http_headers_parser.c
http_headers_parser.c
 
 
http_headers_parser.h
http_headers_parser.h
 
 
http_request.c
http_request.c
 
 
http_request.h
http_request.h
 
 
rio.c
rio.c
 
 
rio.h
rio.h
 
 
socketlib.c
socketlib.c
 
 
socketlib.h
socketlib.h
 
 
threadpool.c
threadpool.c
 
 
threadpool.h
threadpool.h
 
 
tinyhttpd.c
tinyhttpd.c
 
 
tinyhttpd.conf
tinyhttpd.conf
 
 
tinyhttpd.h
tinyhttpd.h
 
 
util.c
util.c
 
 
util.h
util.h
 
 

Repository files navigation

tinyhttpd

tinyhttpd is a minimum functional HTTP server written in the C programming language.

Compile and run

For now tinyhttpd only support Linux 2.6 or later.

Please make sure you have cmake installed.

mkdir build && cd build
cmake .. && make
cd .. && ./build/tinyhttpd &

By default the server runs on port 8008, if you want to assign other port for the server, run it as ./build/tinyhttpd port &.

In order to avoid showing too much stdout/stderr message, you can run ./build/tinyhttpd [port] 2>&1 >tinyhttpd.log & to redirect both stdout and stderr to a log file.

Programming model

  • epoll
  • non-blocking I/O
  • threadpool

Performance

I have made a small performance test with Zaver, a fast and efficient HTTP server(I have learned a lot from it). In a way it was not a fair comparasion, for the number of total transferred bytes was not equal and the processing logic in tinyhttpd is relatively simple.

ab -n 10000 -c 500 http://127.0.0.1:8008/doc/index.html
cpu: Intel(R) Xeon(R) CPU L5630  @ 2.13GHz, 8 cores.
mem: 32GB.

Zaver

Server Software:        Zaver
Server Hostname:        0.0.0.0
Server Port:            3000

Document Path:          /html/index.html
Document Length:        170 bytes

Concurrency Level:      500
Time taken for tests:   10.172 seconds
Complete requests:      10000
Failed requests:        0
Non-2xx responses:      10000
Total transferred:      2760000 bytes
HTML transferred:       1700000 bytes
Requests per second:    983.10 [#/sec] (mean)
Time per request:       508.594 [ms] (mean)
Time per request:       1.017 [ms] (mean, across all concurrent requests)
Transfer rate:          264.98 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    3   7.9      0      47
Processing:   499  502   6.2    501     547
Waiting:        0    2   3.9      1      30
Total:        499  505  12.6    501     564

Percentage of the requests served within a certain time (ms)
  50%    501
  66%    502
  75%    502
  80%    502
  90%    507
  95%    547
  98%    558
  99%    562
 100%    564 (longest request)
 

tinyhttpd

Server Software:
Server Hostname:        127.0.1.1
Server Port:            8008

Document Path:          /doc/index.html
Document Length:        173 bytes

Concurrency Level:      500
Time taken for tests:   3.695 seconds
Complete requests:      10000
Failed requests:        0
Total transferred:      2170000 bytes
HTML transferred:       1730000 bytes
Requests per second:    2706.40 [#/sec] (mean)
Time per request:       184.747 [ms] (mean)
Time per request:       0.369 [ms] (mean, across all concurrent requests)
Transfer rate:          573.52 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0   88 381.2      0    3005
Processing:    10   55  33.2     44     456
Waiting:       10   54  33.2     44     456
Total:         41  143 385.8     45    3259

Percentage of the requests served within a certain time (ms)
  50%     45
  66%     50
  75%     55
  80%     61
  90%    151
  95%   1049
  98%   1061
  99%   3053
 100%   3259 (longest request)

About

tinyhttpd is a minimum functional HTTP server with epoll & non-blocking I/O & threadpool programming model

Resources

Readme
MIT license
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.