참고 : 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")
}
'가지가지' 카테고리의 다른 글
[인증서] http 인증서 localhost용 (0) | 2018.10.28 |
---|---|
webpack 에 jquery가 두가지 버전이 들어갈때 문제 (0) | 2018.09.19 |
chrome 특정 element 캡쳐 뜨기 (0) | 2018.06.29 |
[superset] dashboard, chart 공유 최소 permission 권한 (0) | 2018.06.01 |
bash script 현재 디렉토리 (0) | 2018.02.21 |
python hs256 = hmac + sha256 (0) | 2018.02.20 |
동영상 스트리밍 관련 (0) | 2017.11.30 |
CMD 특정 디렉토리에서 실행(command line windows) (0) | 2017.11.23 |