go服务器与nginx性能,比Nginx性能还高的web服务器:NXWEB

NXWEB何许人也?莫非来自星星的你?

好吧,其实NXWEB是C语言写的一个超快超轻量级的web服务器,就这么简单。作者:Yaroslav Stavnichiy,官网

也许有人会有疑问,webserver领域既然已经有老牌劲旅Apache,新科状元Nginx,我们还需要其他web服务器吗?其实互联网的复杂性总会产生各种各样的需求,比如功能单一,简洁,追求高并发,占用系统性能少,超轻量级的web服务还是有一定的市场。

比如:广告曝光展现引擎,它会根据预定义的配置调用多次站点的每一页上产生的小HTML片段,这种应用如何实现呢?

CGI应该不是一个好的选择,因为它处理每个请求都需要进行加载和卸载操作,极大影响了请求的处理速度。当然可以在一些主流web服务器,比如Apache,nginx上面编写模块,以提供更好的性能,但是上述web服务器的API也不是非常完美,甚至不是很友好,这样NXWEB上场啦!

NXWEB拥有怎样的特性敢叫板其他webserver?

能提供最好的性能,详见压力测试数据

能够处理数上万的并发请求

占用极少内存

event驱动,多线程模块开发

异常代码库

API简单明了

良好的HTTP协议处理

支持长连接

支持SSL(基于GNUTLS)

支持非阻塞传输文件(支持可配置的小文件内存缓存)

可缓存gzip编码的内容

可缓存图像缩略图水印(通过ImageMagick)

模块化设计,方便开发人员进行模块开发

可以作为守护进程运行

压力测试数据:

NXWEB 3.0 Benchmarks

NXWEB v3 is even faster than v2.

Results are in thousands requests per second. F = failed. NA = not supported. Measured by httpress on 4-core CPU (without AES-NI).

Test

NXWEB

G-WAN

libevent

microhttpd

mongoose

nginx

1. hello 100 ka

200 / 121

144

30 / 69

132

190

141

2. hello 100

51 / 42

41

15 / 32

13

34

41

3. hello 1000 ka

160 / 115

130

21 / 43

130

180

124

4. hello 1000

46 / 38

38

14 / 30

12

35

40

5. hello 10000 ka

115 / 84

103

23 / 40

116

119

108

5.1. real concurrency

9500-10000

9500-10000

10000

600-1000

1500-1700

4000-7000

5.2. memory footprint

28Mb

105Mb

4x15Mb

6. hello 10000

38 / 34

33

14 / 27

9

20

29

7. file 2.3K ka

133

NA

NA

NA

5

98

7.1. file 2.3K ka cached

145

120

NA

NA

NA

NA

8. file 2.3K

42

NA

NA

NA

12

39

8.1. file 2.3K cached

43

33

NA

NA

NA

NA

9. file 100K ka

36

15

NA

NA

3.6

32

10. file 100K

23

12

NA

NA

3.5

21

11. file 2.1M ka

3.2

0.7

NA

NA

0.6

2.6

12. file 2.1M

2.3

0.6

NA

NA

0.5

2.0

Test descriptions:

Minimal handler returning '

Hello, world!

'; 100 concurrent, keep-alive (httpress -c 100 -n 1000000 -t 4 -k)

Minimal handler returning '

Hello, world!

'; 100 concurrent, no keep-alive (httpress -c 100 -n 500000 -t 4)

Minimal handler returning '

Hello, world!

'; 1000 concurrent, keep-alive (httpress -c 1000 -n 1000000 -t 4 -k)

Minimal handler returning '

Hello, world!

'; 1000 concurrent, no keep-alive (httpress -c 1000 -n 500000 -t 4)

Minimal handler returning '

Hello, world!

'; 10000 concurrent, keep-alive (httpress -c 10000 -n 1000000 -t 4 -k)

httpress tool allows to calculate real concurrency, the number of actually active connections participating in test

10K concurrent connections take a lot of RAM. Here you can see how much

Minimal handler returning '

Hello, world!

'; 10000 concurrent, no keep-alive (httpress -c 10000 -n 500000 -t 4)

Disk file 2.3 KiB; 400 concurrent connections, keep-alive

Disk file 2.3 KiB; 400 concurrent connections, keep-alive, using memory cache

Disk file 2.3 KiB; 400 concurrent connections, no keep-alive

Disk file 2.3 KiB; 400 concurrent connections, no keep-alive, using memory cache

Disk file 100 KiB; 400 concurrent connections, keep-alive

Disk file 100 KiB; 400 concurrent connections, no keep-alive

Disk file 2.1 MiB; 400 concurrent connections, keep-alive

Disk file 2.1 MiB; 400 concurrent connections, no keep-alive

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

Minimalhandlerreturning'

Hello, world!

';100concurrent,keep-alive(httpress-c100-n1000000-t4-k)

Minimalhandlerreturning'

Hello, world!

';100concurrent,nokeep-alive(httpress-c100-n500000-t4)

Minimalhandlerreturning'

Hello, world!

';1000concurrent,keep-alive(httpress-c1000-n1000000-t4-k)

Minimalhandlerreturning'

Hello, world!

';1000concurrent,nokeep-alive(httpress-c1000-n500000-t4)

Minimalhandlerreturning'

Hello, world!

';10000concurrent,keep-alive(httpress-c10000-n1000000-t4-k)

httpresstoolallowstocalculaterealconcurrency,thenumberofactuallyactiveconnectionsparticipatingintest

10KconcurrentconnectionstakealotofRAM.Hereyoucanseehowmuch

Minimalhandlerreturning'

Hello, world!

';10000concurrent,nokeep-alive(httpress-c10000-n500000-t4)

Diskfile2.3KiB;400concurrentconnections,keep-alive

Diskfile2.3KiB;400concurrentconnections,keep-alive,usingmemorycache

Diskfile2.3KiB;400concurrentconnections,nokeep-alive

Diskfile2.3KiB;400concurrentconnections,nokeep-alive,usingmemorycache

Diskfile100KiB;400concurrentconnections,keep-alive

Diskfile100KiB;400concurrentconnections,nokeep-alive

Diskfile2.1MiB;400concurrentconnections,keep-alive

Diskfile2.1MiB;400concurrentconnections,nokeep-alive

开源其他的压力测试数据:

Server

Version

Req/s

% of httpd static

Notes

nxweb static file

3.2.0-dev

512,767

347.1 %

“memcache”:false. (626,270 if true)

nginx static file

1.0.15

430,135

291.1 %

stock CentOS 6.3 rpm

httpd static file

2.4.4, mpm_event

147,746

100.0 %

mod_python handler

3.5, Python 2.7.5

125,139

84.7 %

1.9.18.2

119,175

80.7 %

-p 16 –threads 1

mod_python wsgi

3.5, Python 2.7.5

87,304

59.1 %

3.4

76,251

51.6 %

embedded mode

nxweb wsgi

3.2.0-dev, Python 2.7.5

15,141

10.2 %

posibly misconfigured?

看看上述数据,爱折腾的ops们不想尝试一下?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值