Snippets

xchandan Web App Deploy

You are viewing an old version of this snippet. View the current version.
Revised by xchandan ea4189f
TEST
====

ab -c100 -n100000 http://localhost:8181/


FLASK_APP
=========

Server Software:        Werkzeug/0.15.1
Server Hostname:        localhost
Server Port:            8181

Document Path:          /
Document Length:        120000 bytes

Concurrency Level:      100
Time taken for tests:   172.248 seconds
Complete requests:      100000
Failed requests:        0
Total transferred:      12015800000 bytes
HTML transferred:       12000000000 bytes
Requests per second:    580.56 [#/sec] (mean)
Time per request:       172.248 [ms] (mean)
Time per request:       1.722 [ms] (mean, across all concurrent requests)
Transfer rate:          68123.93 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.7      0      40
Processing:     2  172 211.6    112    1347
Waiting:        2  171 210.1    112    1344
Total:          4  172 211.7    112    1347

Percentage of the requests served within a certain time (ms)
  50%    112
  66%    115
  75%    118
  80%    121
  90%    137
  95%    851
  98%    997
  99%   1053
 100%   1347 (longest request)


Gevent
======

Server Software:        
Server Hostname:        localhost
Server Port:            8181

Document Path:          /
Document Length:        120000 bytes

Concurrency Level:      100
Time taken for tests:   70.692 seconds
Complete requests:      100000
Failed requests:        0
Total transferred:      12013900000 bytes
HTML transferred:       12000000000 bytes
Requests per second:    1414.58 [#/sec] (mean)
Time per request:       70.692 [ms] (mean)
Time per request:       0.707 [ms] (mean, across all concurrent requests)
Transfer rate:          165963.58 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.2      0      22
Processing:     1   71  20.1     67     305
Waiting:        1   70  20.0     67     305
Total:          3   71  20.1     67     305

Percentage of the requests served within a certain time (ms)
  50%     67
  66%     68
  75%     69
  80%     70
  90%     77
  95%     83
  98%     94
  99%    221
 100%    305 (longest request)
from gevent import monkey
monkey.patch_all()

#from gevent.pool import Pool
from gevent.pywsgi import WSGIServer
from api import app

#http_server = WSGIServer(('', 8181), app, spawn=Pool(10))
http_server = WSGIServer(('', 8181), app)
http_server.serve_forever()

# python server-gevent.py
import requests

from flask import Flask
app = Flask(__name__)

msg = "Hello World!"*10000

@app.route("/")
def hello():
    #requests.get('http://127.0.0.1:9191')
    return msg

if __name__ == '__main__':
    app.run('127.0.0.1', 8181)


# FLASK_APP=api.py flask run -p 8181
HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.