简体   繁体   English

烧瓶应用非常缓慢

[英]flask application is very slow

I am currently developing an app that is served with a flask web server. 我目前正在开发与Flask Web服务器一起使用的应用程序。

The back end python code has become extremely huge (to the tune of 1000 lines of code to give readers a perspective) with a lot of dependencies. 后端python代码已经变得非常庞大(多达1000行代码可以使读者有一个视角),并且具有很多依赖性。

As a result, even simple api calls such as this: 结果,即使是简单的api调用,例如:

@app.route('/', methods = ['GET'])
def hello():
    return "Sample"

results in the request taking close to 900 ms to serve. 导致请求需要近900毫秒的服务时间。

Would anyone be able to give me tips on improving the latency? 任何人都可以给我有关改善延迟的提示吗? Would blueprinting help in this scenario? 在这种情况下,设计蓝图会有所帮助吗?

The dependencies we have are all critical (we could perhaps remove one or two of them, but thats about it)... 我们所拥有的依赖关系都是至关重要的(我们也许可以删除其中的一两个,但是仅此而已)...

Any help is greatly appreciated 任何帮助是极大的赞赏

Thanks, Galeej 谢谢,Galeej

Flask is a microframework for Python. Flask是Python的微框架。 It is not a web server. 它不是Web服务器。

A lot of reasons would cause a slow response. 有很多原因会导致响应缓慢。 But I don't think dependencies or blueprinting is the problem. 但是我不认为依赖或蓝图是问题所在。 If you can provide how you deploy your app that would be helpful. 如果您可以提供如何部署应用程序,那将有所帮助。

I think the most critical and simple thing is to log timestamp of each main process, then find which part cost a lot. 我认为最关键和最简单的事情是记录每个主要过程的时间戳,然后找出哪个部分花费很多。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM