My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Links

what is iphttpd?

high performance simple HTTP service for query ip location. 高性能轻量级IP地理位置查询Http服务。

并发100的情况下,每秒处理能力高达:20229.24/sec。

Any question, please let me know: bit.kevin@gmail.com

install

wget --no-check-certificate "https://github.com/downloads/libevent/libevent/libevent-2.0.16-stable.tar.gz"
tar zxf libevent-2.0.16-stable.tar.gz
cd libevent-2.0.16-stable/
./configure --prefix=/usr/local/libevent-2.0.16-stable/
make
sudo make install
cd ../

wget "http://iphttpd.googlecode.com/files/iphttpd-0.1.1.tar.gz"
tar zxf iphttpd-0.1.1.tar.gz
cd iphttpd
make
sudo make install

run

# show help
iphttpd -h

# run
# default will listen on 0.0.0.0:8080, daemon
iphttpd -f /data_path/qqwry.dat

# stop
killall iphttpd

usage

# show iphttpd status
curl "http://127.0.0.1:8080/_status"

# get ip location
# will get: <country>\t<area>
curl "http://127.0.0.1:8080/?ip=111.192.166.25"
# or
curl "http://127.0.0.1:8080/?ip=111.192.166.25" | iconv -f 'gbk' -t 'utf-8'

benchmark

iphttpd run at 10.255.255.33, and use apache ab tool from another machine.

10.255.255.33

  • 8 x Intel(R) Xeon(R) CPU E5504 @ 2.00GHz
  • 16GB Mem
  • iphttpd -f /home/pzb/iphttpd/qqwry.dat -t 8

$ ab -c 100 -n 100000 "http://10.255.255.33:8080/?ip=111.192.166.25"
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking 10.255.255.33 (be patient)
Completed 10000 requests
Completed 20000 requests
Completed 30000 requests
Completed 40000 requests
Completed 50000 requests
Completed 60000 requests
Completed 70000 requests
Completed 80000 requests
Completed 90000 requests
Finished 100000 requests


Server Software:        IpHttpd/0.1
Server Hostname:        10.255.255.33
Server Port:            8080

Document Path:          /?ip=111.192.166.25
Document Length:        11 bytes

Concurrency Level:      100
Time taken for tests:   4.943339 seconds
Complete requests:      100000
Failed requests:        0
Write errors:           0
Total transferred:      11302034 bytes
HTML transferred:       1100198 bytes
Requests per second:    20229.24 [#/sec] (mean)
Time per request:       4.943 [ms] (mean)
Time per request:       0.049 [ms] (mean, across all concurrent requests)
Transfer rate:          2232.70 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   1.1      1       4
Processing:     1    3   1.0      4      20
Waiting:        0    1   0.8      1      17
Total:          1    4   1.2      4      21

Percentage of the requests served within a certain time (ms)
  50%      4
  66%      5
  75%      5
  80%      5
  90%      6
  95%      6
  98%      7
  99%      8
 100%     21 (longest request)
Powered by Google Project Hosting