x-cold / task-queue-sample

Node.js 生产者/消费者 模式简单实践 - 多进程爬虫任务队列

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

学习目的

  • 了解和使用生产者/消费者模式

  • 了解任务调度

  • 掌握基本的分布式架构及通讯

  • 掌握Node.js多进程工作机制

概念须知

参考文章:http://blog.csdn.net/kaiwii/article/details/6758942

生产者/消费者 爬虫

  • 启动缓存队列
> cd cache
> npm install
> npm run koa
  • 启动生产者进程
> npm install
> node ./producer/cluster.js [进程数量]
  • 启动消费者进程
> npm install
> node ./customer/cluster.js [进程数量]

About

Node.js 生产者/消费者 模式简单实践 - 多进程爬虫任务队列


Languages

Language:JavaScript 100.0%