eventlet

How to combine multiprocessing and eventlet

安稳与你 提交于 2019-12-02 01:23:14
I have a task need to start 2 processes and within each process need to start 2 threads to do really work. Below is the source code I used to simulate my use case. import multiprocessing import eventlet def subworker(num1, num2): print 'Start subworker %d,%d\n' % (num1, num2) eventlet.sleep(10) print 'End subworker %d,%d\n' % (num1, num2) def worker(**kwargs): number = kwargs['number'] pool = eventlet.GreenPool(size=2) pool.spawn_n(subworker, number, 1) pool.spawn_n(subworker, number, 2) pool.waitall() def launcher(number): kwargs = {'number': number} th = multiprocessing.Process(target=worker

What happens when a single request takes a long time with these non-blocking I/O servers?

对着背影说爱祢 提交于 2019-12-01 16:12:13
With Node.js, or eventlet or any other non-blocking server, what happens when a given request takes long, does it then block all other requests? Example, a request comes in, and takes 200ms to compute, this will block other requests since e.g. nodejs uses a single thread. Meaning your 15K per second will go down substantially because of the actual time it takes to compute the response for a given request. But this just seems wrong to me, so I'm asking what really happens as I can't imagine that is how things work. Whether or not it "blocks" is dependent on your definition of "block". Typically

What happens when a single request takes a long time with these non-blocking I/O servers?

天大地大妈咪最大 提交于 2019-12-01 15:25:10
问题 With Node.js, or eventlet or any other non-blocking server, what happens when a given request takes long, does it then block all other requests? Example, a request comes in, and takes 200ms to compute, this will block other requests since e.g. nodejs uses a single thread. Meaning your 15K per second will go down substantially because of the actual time it takes to compute the response for a given request. But this just seems wrong to me, so I'm asking what really happens as I can't imagine

Eventlet or gevent or Stackless + Twisted, Pylons, Django and SQL Alchemy

≯℡__Kan透↙ 提交于 2019-11-29 19:20:21
We're using Twisted extensively for apps requiring a great deal of asynchronous io. There are some cases where stuff is cpu bound instead and for that we spawn a pool of processes to do the work and have a system for managing these across multiple servers as well - all done in Twisted. Works great. The problem is that it's hard to bring new team members up to speed. Writing asynchronous code in Twisted requires a near vertical learning curve. It's as if humans just don't think that way naturally. We're considering a mixed approach perhaps. Maybe keep the xmlrpc server part and process

`eventlet.spawn` doesn't work as expected

喜夏-厌秋 提交于 2019-11-28 11:40:05
I'm writing a web UI for data analysis tasks. Here's the way it's supposed to work: After a user specifies parameters like dataset and learning rate , I create a new task record , then a executor for this task is started asyncly (The executor may take a long time to run.), and the user is redirected to some other page. After searching for an async library for python , I started with eventlet , here's what I wrote in a flask view function: db.save(task) eventlet.spawn(executor, task) return redirect("/show_tasks") With the code above, the executor didn't execute at all. What may be the problem

Celery + Eventlet + non blocking requests

这一生的挚爱 提交于 2019-11-28 10:07:48
I am using Python requests in celery workers to make large number of (~10/sec) API calls(includes GET,POST, PUT, DELETE). Each request takes around 5-10s to complete. I tried running celery workers in eventlet pool, with 1000 concurrency. Since requests are blocking process each concurrent connection is waiting on one request. How do I make requests asynchronous? temoto Use eventlet monkey patching to make any pure python library non-blocking. patch single library # import requests # instead do this: import eventlet requests = eventlet.import_patched('requests') packages erequests and

error: command 'gcc' failed with exit status 1 while installing eventlet

孤人 提交于 2019-11-26 12:38:53
I wanted to install eventlet on my system in order to have "Herd" for software deployment.. but the terminal is showing a gcc error: root@agrover-OptiPlex-780:~# easy_install -U eventlet Searching for eventlet Reading http://pypi.python.org/simple/eventlet/ Reading http://wiki.secondlife.com/wiki/Eventlet Reading http://eventlet.net Best match: eventlet 0.9.16 Processing eventlet-0.9.16-py2.7.egg eventlet 0.9.16 is already the active version in easy-install.pth Using /usr/local/lib/python2.7/dist-packages/eventlet-0.9.16-py2.7.egg Processing dependencies for eventlet Searching for greenlet>=0