简体   繁体   English

XML-RPC Python在首次请求前缓慢

[英]XML-RPC Python Slow before first request

I am running a simulation and transmitting data through XML-RPC to a remote client. 我正在运行模拟,并通过XML-RPC将数据传输到远程客户端。 I'm using a thread to run the XML-RPC part. 我正在使用一个线程来运行XML-RPC部分。 But for some reason, the program runs really slow until I a make a request from any of clients that connect. 但是由于某种原因,该程序的运行速度非常慢,直到我从任何连接的客户端发出请求为止。 And after I run the very first request, the program then runs fine. 在我运行了第一个请求之后,该程序就可以正常运行了。 I have a class that inherits from Threading, and that I use in order to start the XML-RPC stuff 我有一个从Threading继承的类,并用于启动XML-RPC内容

I cannot really show you the code, but do you have any suggestions as to why this is happening? 我无法真正向您展示代码,但是您对为什么会发生这种情况有任何建议吗?

Thanks, and I hope my question is clear enough 谢谢,我希望我的问题很清楚

In Python, due to the GIL, threads doesn't really execute in parallel. 在Python中,由于GIL,线程实际上并不是并行执行的。 If the RPC part is waiting in an active way (loop poling for connection instead of waiting), you most probably will have the behavior you are describing. 如果RPC部分正在以主动方式等待(为连接而不是等待而循环轮询),则您很可能会遇到所描述的行为。 However, without seeing any code, this is just wild guess. 但是,没有看到任何代码,这只是一个疯狂的猜测。

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

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