美文网首页
web框架并发5--japronto

web框架并发5--japronto

作者: 流亡民头 | 来源:发表于2019-01-22 19:12 被阅读0次

 由于机器是python2.7, 但正好有docker环境, 就直接用docker的方式体验传说的120万并发架构

一、环境

1. docker pull japronto/japronto

二、代码(test_japronto.py)

# examples/1_hello/hello.py

from japronto import Application

# Views handle logic, take request as a parameter and

# returns Response object back to the client

def hello(request):

    return request.Response(text='Hello world!')

# The Application instance is a fundamental concept.

# It is a parent to all the resources and all the settings

# can be tweaked here.

app = Application()

# The Router instance lets you register your handlers and execute

# them depending on the url path and methods

app.router.add_route('/', hello)

# Finally start our server and handle requests until termination is

# requested. Enabling debug lets you see request logs and stack traces.

app.run(debug=True)

三、启动web服务命令

docker run -p 8080:8080 -v $(pwd)/test_japronto.py:/test_japronto.py japronto/japronto --script /test_japronto.py

四、测试结果

1. webbench -c 1 -t 10 http://127.0.0.1:8080/

Speed=254358 pages/min, 390015 bytes/sec.

Requests: 42393 susceed, 0 failed.

2.webbench -c 10 -t 10 http://127.0.0.1:8080/

Speed=694422 pages/min, 1064798 bytes/sec.

Requests: 115737 susceed, 0 failed.

3. webbench -c 20 -t 10 http://127.0.0.1:8080/

Speed=710580 pages/min, 1089565 bytes/sec.

Requests: 118430 susceed, 0 failed.

由2和3的结果可知, 客户端数量的增加, 并发能力并无明显增加。

相关文章

  • web框架并发5--japronto

    由于机器是python2.7, 但正好有docker环境, 就直接用docker的方式体验传说的120万并发架构 ...

  • Djano面试题

    1. Python常用的Web开发框架 1. 企业级开发框架——Django 组成部分 2. 高并发处理框架——t...

  • python web高并发框架思考

    前言(一般这里说下写文章的原因): 首先作为一个QA,写过大大下下的web项目有十几个了,但是遗憾的是一直没有一个...

  • web框架并发1--tornado

    当下好多“王婆”卖瓜, 一个劲说架构并发能力 10万、100万, 但看到大家实际并发测试, 确少得可怜。 先说说t...

  • web框架并发2--nginx

    单服务器的并发能力需要依赖多方法的优化。 nginx 服务的并发能力如何 一、 配置 user root; wor...

  • Python 四大主流网络编程框架

    高并发处理框架—— Tornado Tornado 是使用 Python 编写的一个强大的可扩展的 Web 服务器...

  • Python 并发编程概念

    本篇文章,我们会详细剖析python并发编程的一些概念还有编程方法,并且同时将所学,对一些大家常用的web框架并发...

  • Python Web框架以及x-sendfile

    Python Web框架 Flask:轻量实用的Web框架 Tornado:Facebook的开源异步Web框架 ...

  • web框架并发3--go stdlib

    go 版本:go version go1.6 linux/amd64 一、代码: package main imp...

  • web框架并发4--go fasthttp

    go 版本:go version go1.10.7 linux/amd64 一、代码 package main i...

网友评论

      本文标题:web框架并发5--japronto

      本文链接:https://www.haomeiwen.com/subject/feurjqtx.html