本文介绍了线程池和短期线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

文档中的任何地方都有建议使用来自

线程池的线程来完成相对较短的任务。据我了解,从互联网上获取一个页面

或多页(有时多达50页但不是典型的)和

对这些页面进行一些处理将被认为是来自池的

a线程的大/长任务。在我们的应用程序中,可以将任务分解为一些

小的(每次获取和处理的线程或更小的事件),但

我们创建的线程越多越多我们得到的上下文切换

平衡点在哪里?我们对大/长任务会有什么处罚?


还有一件事。似乎存在大量异步

IO的错误,其中线程死锁和超时(它遍布开发人员

社区)。关于何时修复的任何信息?


谢谢,

阿列克谢

Everywhere in documentation there are recommendations to use threads from
thread pooling for relatively short tasks. As I understand, fetching a page
or multiple pages (sometimes up to 50 but not tipical) from the Internet and
doing some processing on those would be considered to be a big/long task for
a thread from a pool. In our app it is possible to break the task into some
small ones (thread per fetch and processing thereafter or event smaller), but
the more threads we create the more context switches we get. Where is the
ballance point? What penalties do we incur for big/long tasks?

One more thing. There seems to be a bug with large numbers of asynchronous
IO where threads deadlock and timeout (it is all over the developers
communities). Any info on when the fix is going to be out?

Thank you,

Alexei

推荐答案









这篇关于线程池和短期线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-01 01:03