当前位置: 动力学知识库 > 问答 > 编程问答 >

python - jsonify is much slower on external server than localhost

问题描述:

I have a view that uses jsonify that is much slower on an external server than on localhost. Why does it take so long running on :5000 externally?

data = pickle.load(open("file.pkl", "rb"))

@app.route('getData')

def returnData():

return jsonify(data)

The file.pkl is a locally stored CSV of 100,000 lines (9 MB). When run locally the json loads in Javascript in 3 seconds. When run externally it takes 20 seconds.

In Javascript:

var dataLoader = $.get('./getData').then(function (data){

newData = data;

});

分享给朋友:
您可能感兴趣的文章:
随机阅读: