01 2020 档案

摘要:Remote procedure call (RPC)What This Tutorial Focuses OnIn the second tutorial we learned how to use Work Queues to distribute time-consuming tasks among multiple workers.在第二篇教程中我们学到了如何使用Work Queues在多... 阅读全文
posted @ 2020-01-19 22:04 InfiniteCodes 阅读(175) 评论(0) 推荐(0)
摘要:What This Tutorial Focuses OnIn the previous tutorial we improved our logging system. Instead of using a fanout exchange only capable of dummy broadcasting, we used a direct one, and gained a possibil... 阅读全文
posted @ 2020-01-19 16:23 InfiniteCodes 阅读(192) 评论(0) 推荐(0)
摘要:What This Tutorial Focuses OnIn the previous tutorial we built a simple logging system. We were able to broadcast log messages to many receivers.之前的教程我们构建了简单的日志系统。我们已经能够广播日志消息给多个接收端。In this tutorial w... 阅读全文
posted @ 2020-01-18 16:22 InfiniteCodes 阅读(172) 评论(0) 推荐(0)
摘要:Publish/Subscribe发布/订阅What This Tutorial Focuses OnIn the previous tutorial we created a work queue. The assumption behind a work queue is that each task is delivered to exactly one worker. In this pa... 阅读全文
posted @ 2020-01-17 23:46 InfiniteCodes 阅读(196) 评论(0) 推荐(0)
摘要:Work QueuesPrerequisitesAs with other Python tutorials, we will use the Pika RabbitMQ client version 1.0.0.就像其他的Python教程一样,我们使用Pika RabbitMQ客户端版本1.0.0 ... 阅读全文
posted @ 2020-01-17 16:10 InfiniteCodes 阅读(209) 评论(0) 推荐(0)
摘要:IntroductionRabbitMQ is a message broker: it accepts and forwards messages. You can think about it as a post office: when you put the mail that you want posting in a post box, you can be sure that Mr.... 阅读全文
posted @ 2020-01-11 17:52 InfiniteCodes 阅读(282) 评论(0) 推荐(0)
摘要:RabbitMQ介绍以下内容搬运自RabbitMQ官网RabbitMQ is the most widely deployed open source message broker.RabbitMQ是使用最广泛的开源的消息中转器With tens of thousands of users, RabbitMQ is one of the most popular open source messa... 阅读全文
posted @ 2020-01-11 11:04 InfiniteCodes 阅读(398) 评论(0) 推荐(0)
摘要:Select版FTP需求:实现文件上传及下载功能 支持多连接并发传文件 使用select or selectors 阅读全文
posted @ 2020-01-05 14:39 InfiniteCodes 阅读(167) 评论(0) 推荐(0)
摘要:Selectors This module allows high-level and efficient I/O multiplexing, built upon the select module primitives. Users are 该模块允许高级和高效的I/O多路复用,在原select 阅读全文
posted @ 2020-01-05 14:28 InfiniteCodes 阅读(192) 评论(0) 推荐(0)
摘要:Select()版Socket Python的select()方法直接调用操作系统的IO接口,它监控sockets,open files, and pipes(所有带fileno()方法的文件句柄)何时变成readable 和writeable, 或者通信错误,select()使得同时监控多个连接变 阅读全文
posted @ 2020-01-03 17:53 InfiniteCodes 阅读(132) 评论(0) 推荐(0)
摘要:select,poll,epoll都是IO多路复用的机制。I/O多路复用就是通过一种机制,一个进程可以监视多个描述符,一旦某个描述符就绪(一般是读就绪或者写就绪),能够通知程序进行相应的读写操作。但select,poll,epoll本质上都是同步I/O,因为他们都需要在读写事件就绪后自己负责进行读写 阅读全文
posted @ 2020-01-03 16:34 InfiniteCodes 阅读(126) 评论(0) 推荐(0)
摘要:事件驱动与异步IO 通常,我们写服务器处理模型的程序时,有以下几种模型: (1)每收到一个请求,创建一个新的进程,来处理该请求; (2)每收到一个请求,创建一个新的线程,来处理该请求; (3)每收到一个请求,放入一个事件列表,让主进程通过非阻塞I/O方式来处理请求 上面的几种方式,各有千秋, 第(1 阅读全文
posted @ 2020-01-03 16:04 InfiniteCodes 阅读(185) 评论(0) 推荐(0)
摘要:GeventGevent 是一个第三方库,可以轻松通过gevent实现并发同步或异步编程,在gevent中用到的主要模式是Greenlet, 它是以C扩展模块形式接入Python的轻量级协程。 Greenlet全部运行在主程序操作系统进程的内部,但它们被协作式地调度。示例import gevent#gevent,自动挡切换def func1(): print('Ashley starts r... 阅读全文
posted @ 2020-01-02 18:17 InfiniteCodes 阅读(175) 评论(0) 推荐(0)
摘要:协程协程,又称微线程,纤程。英文名coroutine。简单说:协程是一种用户态的轻量级线程。协程拥有自己的寄存器上下文和栈。写成调度切换时,将寄存器上下文和栈保存到其他地方,在且回来的时候,恢复先前保存的寄存器上下文和栈。因此,协程能保留上一次调用时的状态(即所有局部状态的一个特定组合),每次过程重入时,就相当于进入上一次调用的状态,换句话说:进入上一次离开时所处逻辑流的位置。协程的优点:无需线程... 阅读全文
posted @ 2020-01-02 17:07 InfiniteCodes 阅读(141) 评论(0) 推荐(0)