Compare and test the performance of Nginx static files in FreeBSD and Linux

Source: Internet
Author: User
Tags vps
Recently, I am preparing to change the VPS. If VPS supports FreeBSD, I plan to try it. If you want to know the differences between it and linux performance, you can find some articles on the Internet. Many articles have mentioned that FreeBSD is more suitable for front-end file servers. Its database performance and SMP performance are inferior to those of linux. However, these articles are either old or purely verbal, lacking

Recently, I am preparing to change the VPS. If VPS supports FreeBSD, I plan to try it. If you want to know the differences between it and linux performance, you can find some articles on the Internet. Many articles have mentioned that FreeBSD is more suitable for front-end file servers. Its database performance and SMP performance are inferior to those of linux. However, these articles are either old or purely verbal, and lack detailed data support. So I decided to install several more virtual machines to test it.

Test environment:
Host:
Core i3 530 @ 2.93 GHz dual-Core 4-Thread
16 GB RAM
Windows 7 64bit

Virtual Machine Software:
Virtualbox 4.1.2

Virtual Machine Configuration:
FreeBSD 7.2 i386/FreeBSD 8.2 amd64/Debian 5.0 i386/CentOS 5.6 i386
Dual-core full speed
256 M RAM
8 GB hard drive
Enable hardwareVirtualizationAnd IO APIC

Each system is installed with the minimum, and then the compilation tool chain + apache (to facilitate the use of AB) +Php+ Mysql. Www. linuxIdAfter c.com, turn off apache and install nginx.
FreeBSD uses ports to compile and install nginx. Debian uses the latest stable version that comes with the source and compiled, and CentOS uses the latest stable version that is compiled. Kqueue should be used by default for FreeBSD nginx, and epoll is used by default for linux.
Set nginx to 1 worker and enable gZip.

Test the use of ApacheBeNcH. The test file is a 57244 bytes jquery. js file.
Apart from CentOS, ApacheBench is Version 2.3 and CentOS is version 2.0.

ab -c 10 -n 100000 http://localhost/jquery.js


The test results are as follows:

FreeBSD 7.2 i386 + nginx 0.6.36

Concurrency Level:      10
Time taken for tests: 26.156 seconds
Complete requests: 100000
Failed requests: 0
Write errors: 0
Total transferred: 5747200000 bytes
HTML transferred: 5724400000 bytes
Requests per second: 3823.15 [#/sec] (mean)
Time per request: 2.616 [ms] (mean)
Time per request: 0.262 [ms] (mean, across all concurrent requests)
Transfer rate: 214574.53 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.2 0 4
Processing: 0 2 0.8 2 18
Waiting: 0 1 0.6 1 16
Total: 0 3 0.7 2 18


FreeBSD 8.2 amd64 + nginx 0.8.54

Concurrency Level:      10
Time taken for tests: 24.675 seconds
Complete requests: 100000
Failed requests: 0
Write errors: 0
Total transferred: 5747257344 bytes
HTML transferred: 5724457116 bytes
Requests per second: 4052.62 [#/sec] (mean)
Time per request: 2.468 [ms] (mean)
Time per request: 0.247 [ms] (mean, across all concurrent requests)
Transfer rate: 227455.77 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.2 0 8
Processing: 1 2 0.6 2 19
Waiting: 0 1 0.5 1 9
Total: 1 2 0.6 2 20


Debian 5.0 i386 + nginx 0.6.32

Concurrency Level:      10
Time taken for tests: 9.808 seconds
Complete requests: 100000
Failed requests: 0
Write errors: 0
Total transferred: 5747257472 bytes
HTML transferred: 5724457244 bytes
Requests per second: 10195.98 [#/sec] (mean)
Time per request: 0.981 [ms] (mean)
Time per request: 0.098 [ms] (mean, across all concurrent requests)
Transfer rate: 572254.98 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 10
Processing: 0 1 1.0 1 94
Waiting: 0 0 0.9 0 94
Total: 0 1 1.0 1 95


Debian 5.0 i386 + nginx 1.0.6

Concurrency Level:      10
Time taken for tests: 9.321 seconds
Complete requests: 100000
Failed requests: 0
Write errors: 0
Total transferred: 5747157471 bytes
HTML transferred: 5724457244 bytes
Requests per second: 10728.92 [#/sec] (mean)
Time per request: 0.932 [ms] (mean)
Time per request: 0.093 [ms] (mean, across all concurrent requests)
Transfer rate: 602156.28 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 7
Processing: 0 1 0.4 1 32
Waiting: 0 0 0.4 0 31
Total: 0 1 0.5 1 32


CentOS 5.6 i386 + nginx 1.0.6

Concurrency Level:      10
Time taken for tests: 9.996502 seconds
Complete requests: 100000
Failed requests: 0
Write errors: 0
Total transferred: 1452132704 bytes
HTML transferred: 1429432704 bytes
Requests per second: 10003.50 [#/sec] (mean)
Time per request: 1.000 [ms] (mean)
Time per request: 0.100 [ms] (mean, across all concurrent requests)
Transfer rate: 141859.42 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 3
Processing: 0 0 0.7 0 9
Waiting: 0 0 0.2 0 6
Total: 0 0 0.7 0 9

Organize:


Contrary to the views in many previous articles, FreeBSD shows a huge disadvantage in testing nginx static file performance.

As this result was very strange, I changed the virtual machine to a single core and tested the ligHttpdThe result is still about twice as high as that of linux. What is the cause of such a huge difference?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.