使用队列的Python多处理生产者/消费者/编写者

时间:2016-06-27 19:18:55

标签: python queue producer-consumer python-multiprocessing

我正在尝试处理大型csv文件(超过10GB)。我使用这个片段来实现生产者 - 消费者 - 编写者模式,并使用多处理来分离IO和加速计算。但我的代码似乎与单个进程代码几乎相同。用<link rel="stylesheet" type="text/css" href="css"> val route = get { pathEndOrSingleSlash { complete( HttpResponse(entity = HttpEntity(ContentTypes.`text/html(UTF-8)`, Source.fromFile(index).mkString)) ) } ~ path("scripts") { complete( HttpResponse(entity = HttpEntity(ContentTypes.`text/html(UTF-8)`, Source.fromFile(javascript).mkString)) ) } ~ path("css") { complete( HttpResponse(entity = HttpEntity(ContentTypes.`text/plain(UTF-8)`, Source.fromFile(css).mkString)) ) } } 替换block=True使其工作速度甚至比单个进程慢。我做错了什么?

block=False

0 个答案:

没有答案
相关问题