使用工具:siege
代码结构:
hello.py
templates
|--hello.html
hello.py代码:
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
@app.route('/<name>')
def index(name=None):
return render_template('hello.html',name=name)
if __name__ == '__main__':
app.run(host='0.0.0.0',port=13579, debug=False)
hello.html代码:
from Flask</title>
{% if name %}
<h1>Hello {
{ name }}!</h1>
{% else %}
<h1>Hello World!</h1>
{% endif %}
flask
命令:siege -c 1000 -r 100 -b http://127.0.0.1:13579/3344
结果:
Transactions: 29511 hits
Availability: 95.08 %