Varnish vs nginx Test report

Source: Internet
Author: User

1: Configuration

Nginx machine Configuration:
CPU: e7500 @ 2.93 GHz (dual-core)
Memory: 4 GB
Varnish machine Configuration:
CPU: e3300 @ 2.50 GHz (dual-core)
Memory: 2 GB
Test Script Execution Machine Configuration:
CPU: AMD phenom (TM) II X4 925 Processor
Memory: 2 GB

2: Test preparation

2.1: Install siege

Verify using the stress testing tool siege (http://www.joedog.org/index/siege-home. Stress testing can be performed concurrently Based on the path. Installation Method:
Download: wget ftp://sid.joedog.org/pub/siege/siege-latest.tar.gz
Installation:
#./Configure
# Make & make install

[root@localhost test] siege -c 100 -r 100 -f varnish_url.txt[root@localhost test] siege -c 100 -r 100 -f nginx_url.txt

Parameter description:
-C 100 concurrent 100 users
-R 100 repeated loops 100 times
-F varnish_url.txt: URL list

2.2: Construct a URL
Constructed 536 URL tests, one of which is an incorrect URL.

To the testing machine,

[root@localhost test] cd /data/htdocs/resources/web[root@localhost test] find . -name "*.jpg" -print > varnish_url.txt

2.3: Enable nginx page caching
To enable nginx image caching, add the following in nginx conf:

Location ~ . * \. (GIF | JPG | JPEG | PNG | BMP | SWF | ico) $ {expires 30d; access_log off;} Thanks to Yu Ge @ smallfishxy for guidance

3: test result after running:

3.1.1: Enable page caching in nginx

Transactions: 10000 hits
Availability: 100.00%
Elapsed time: 65.83 secs
Data transferred: 260.83 MB
Response time: 0.01 secs
Transaction rate:151.91 TRANS/sec
Throughput: 3.96 MB/sec
Concurrency: 2.06
Successful transactions: 9900
Failed transactions: 0
Longest transaction: 3.03
Shortest transaction: 0.00

3.1.2: nginx does not enable page caching
Transactions: 10000 hits
Availability: 100.00%
Elapsed time: 63.90 secs
Data transferred: 266.10 MB
Response time: 0.01 secs
Transaction rate:156.49 TRANS/sec
Throughput: 4.16 MB/sec
Concurrency: 2.18
Successful transactions: 9900
Failed transactions: 0
Longest transaction: 0.35
Shortest transaction: 0.00

3.1.3: Enable the second test of page cache in nginx
Transactions: 10000 hits
Availability: 100.00%
Elapsed time: 63.05 secs
Data transferred: 266.10 MB
Response time: 0.01 secs
Transaction rate:158.60 TRANS/sec
Throughput: 4.22 MB/sec
Concurrency: 2.06
Successful transactions: 9900
Failed transactions: 0
Longest transaction: 0.34
Shortest transaction: 0.00

3.2.1: first test of varnish clearing Cache
Transactions: 10000 hits
Availability: 100.00%
Elapsed time: 62.87 secs
Data transferred: 266.10 MB
Response time: 0.01 secs
Transaction rate:159.06 TRANS/sec
Throughput: 4.23 MB/sec
Concurrency: 1.95
Successful transactions: 9900
Failed transactions: 0
Longest transaction: 0.37
Shortest transaction: 0.00

3.2.2: varnish cache Testing
Transactions: 10000 hits
Availability: 100.00%
Elapsed time: 61.91 secs
Data transferred: 266.10 MB
Response time: 0.01 secs
Transaction rate:161.52 TRANS/sec
Throughput: 4.30 MB/sec
Concurrency: 1.78
Successful transactions: 9900
Failed transactions: 0
Longest transaction: 0.34
Shortest transaction: 0.00

3.2.3 varnish is responsible for balancing Performance
Transactions: 10000 hits
Availability: 100.00%
Elapsed time: 59.75 secs
Data transferred: 266.10 MB
Response time: 0.01 secs
Transaction rate:167.36 TRANS/sec
Throughput: 4.45 MB/sec
Concurrency: 1.98
Successful transactions: 9900
Failed transactions: 0
Longest transaction: 3.01
Shortest transaction: 0.00

4: Conclusion

  • In the case of poor varnish machine performance and high concurrency, it can achieve better performance than nginx.
  • A single image server is read online. varnish can solve the problem that image service is responsible for balancing and reduce the waste caused by nginx on memory storage.
  • With varnish load balancing, the service can continue when a single IMG server fails. Of course varnish is faulty and a backup server is required.

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.