기본 콘텐츠로 건너뛰기

python flask-restplus 간단 성능 테스트

python flask-restplus 간단 성능 테스트

참고 : http://klen.github.io/py-frameworks-bench/

1. python + flask-restplus : 769 rps

실행 : python run.py

2. python + flask-restplus + gunicorn 8 : 3000 rps

실행 : gunicorn run:app --workers=8

3. python + flask-restplus + gunicorn 8 + meinheld(http://meinheld.org/) : 24000 rps

실행 : gunicorn run:app --workers=8 --worker-class=meinheld.gmeinheld.MeinheldWorker

4. go + gin-gonic : 42000 rps

실행 : ./yamoe

클라이언트 실행

wrk -d20s -t10 -c200 http://localhost:5000/hello

테스트 환경

OS ubuntu on virtualbox

CPU : 8 cores RAM : 8 GB

python 3.6.3 Flask==0.11.1 flask-restplus==0.10.1 gunicorn==19.7.1 meinheld==0.6.1

go : go version go1.10.1 linux/amd64

run.py

from flask import Flask from flask_restplus import Api, Resource

app = Flask(__name__) api = Api(app)

@api.route('/hello') class HelloWorld(Resource): def get(self): return {'hello': 'world'}

if __name__ == '__main__': app.run(debug=False)

main.go

package main

import "github.com/gin-gonic/gin" import "net/http" import "fmt" import "runtime"

func main() {

// set use cores //runtime.GOMAXPROCS(runtime.NumCPU())

// get use cores fmt.Println(runtime.GOMAXPROCS(0))

router := gin.Default()

router.GET("/hello", func(c *gin.Context) { c.JSON(http.StatusOK, gin.H{"hello": "world"}) })

router.Run(":5000") }

from http://yamoe.tistory.com/469 by ccl(A) rewrite - 2020-03-07 10:20:48

댓글

이 블로그의 인기 게시물

Flask 13. pythonanywhere에 배포하기

Flask 13. pythonanywhere에 배포하기 Login: PythonAnywhere It's always a pleasure to hear from you! Ask us a question, or tell us what you love or hate about PythonAnywhere. We'll get back to you over email ASAP. Sorry, there was an error connecting to the server. Please try again in a few moments... www.pythonanywhere.com from http://ohdowon064.tistory.com/124 by ccl(A) rewrite - 2020-03-11 15:54:10

[ubuntu] FLASK_APP

[ubuntu] FLASK_APP Development/Debugging 🐞 FLASK_ENV=development FLASK_APP = app.py flask run zsh: command not found: FLASK_APP ✔️ FLASK_ENV=development FLASK_APP=app.py flask run 띄어쓰기를 해서 저런 오류를 출력할수도 있구나 😲 참고 : 108p에서 FLASK가 FKAS로 오타나있다. from http://hee-stories.tistory.com/18 by ccl(A) rewrite - 2020-03-24 17:20:11