In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "Comparative Analysis of Go and Python Web Server performance". Many people will encounter this dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
For comparison, I chose the following Go package:
◆ original Go http package
◆ web.go framework (which uses http packages running in stand-alone mode [standalone mode])
◆ twister framework (it also uses the http package).
And the following Python Web server / framework:
◆ uses the web.py framework of the CherryPy WSGI server
◆ uses flup FastCGI as the web.py framework for background processing of nginx servers.
◆ tornado Asynchronous Server / Framework
◆ nginx is used as the tornado of load balancer.
For each use case, I wrote a small application, a slightly more complex, traditional Hello World example. Any application includes:
◆ uses regular expressions to pass parameters through the URL path
◆ uses statements to create multiple lines of output
◆ uses formatting functions / expressions in the form of printf to format the output.
I think these are common operations in Web applications, so they should be included in any simple performance comparison test. The code for all test applications is in the following link:
◆ Go http
◆ web.go
◆ twister
◆ web.py
◆ tornado
Test environment
The test environment consists of two PC (request initiator and application server) using Gigabit Ethernet links.
Initiator of ◆ request: 2 x Xeon 2.6 GHz with hyperthreading, Debian SID, kernel: 2.6.33.7.2-rt30-1-686 # 1 SMP PREEMPT RT
◆ servers: MSI Netbook with two core Intel U4100 1.30GHz, AC power connected, 64-bit Ubuntu 10.10, kernel: 2.6.35-25-generic # 44-Ubuntu SMP, Python 2.6.6-2ubuntu2, web.py 0.34-2, flup 1.0.2-1, tornado 0.2-1, nginx 0.7.67-3ubuntu1
To generate HTTP requests and evaluate the performance of the test application, I use the siege performance testing tool. Siege can simulate multiple users with multithreading. I used the following command to generate the request:
Siege-c 200-t 20s http: / / SERVER_ADDR: 8080 / Hello/100
Or multiple similar commands to reduce the amount of parameter-c (in this test, I ran multiple Python scripts at the same time). It simulates requests from 200 users and lasts for 20 seconds. This URL causes the Web application to output 100 lines for each request. Go applications use the Go release version 2011-02-01.1.
Result
GOMAXPROCS=1, a Python process:
Frame request rate [1/sec] Go http1350Twister1324Web.go1141Tornado882Tornado+nginx862Web.py+CheryPy169Web.py+nginx114
GOMAXPROCS=2, two Python concurrent processes:
GOMAXPROCS=4, four Python concurrent processes:
Flup FastCGI options for Web.py+nginx work: multiplexed=False, multithreaded=False. If multiplexed=True, it will run more slowly. If multithreaded=True and only one process serves the nginx server, the following error is reported:
This is the end of the content of "Comparative Analysis of Go and Python Web Server performance". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.