Wednesday 15 April 2015

networking - A clean, lightweight alternative to Python's twisted? -


A (long) While I first wrote a web-spider, enabling concurrent requests at the same time For I have multithreaded It was in my Python youth, before I knew about it and made the difficulties related to it for multilingual code (IE, most of the time the CRILIZED ends!) ...

D wants to recreate this code so that it can be made stronger and perform better. There are basically two ways that I could: I could use new in 2.6+ or I could go for some kind of reactor / event-based model. I want to do this later because it is very easy and less error prone.

The question is, what structure would be most appropriate for my needs is a list of the following options that I still know:

  • : The structure of the Python reactor Grandpa: Looks complicated and looks a bit bloated. Sharp learning to learn for small tasks
  • : The greenlet-based framework that was ready for this type of work. Although I look at the code and it is not very beautiful: non-PEP 8 compliant, scattered with print (why do people do it in a framework?), The API seems a bit incompatible.
  • : Immature, it still does not seem to be used by anyone, although it is based on libevent, so she has got a solid backend.
  • : from stdlib: über low level, to get something from the ground.
  • : Although it is a server-oriented product that is designed for server dynamic websites, it offers one more simple feature. It seems that it could work, but no, what to do for it. [EDIT: Unfortunately not running on Windows, which it counts for me - I need to support this lame platform)

Do not I miss anything? Surely there should be a library which fits the sweet spot of a simplified async networking library!

[edit: Many thanks for its suggestion if you scroll down, then you will see that there is a very good list of projects that are aimed at dealing with this task in some other way or another. In fact it seems that things have actually been transferred since twisted: people now seem to support a base solution instead of a conventional reactor / callback oriented one. The benefits of this approach are clear and clear codes: I have certainly found in the past, especially when working in C ++, the callback based code can lead to those designs that can be hard to follow and untrained. The eyes are relatively obscure. Using co-routine, you can write code that looks at least a small synchronous. I think my work is that I want to see one of these libraries and work to go to it! I just asked ...]

[edit] Perhaps it is a matter of following or stumbling upon this subject or worrying about it: I am writing a very good writing of the present situation Found for this job]

I liked Python module that was stackless on Python microthrads or greenlets Depending on weight threading, all the blocked networks I / O transparently have a loop, so it should be efficient as an actual asynchronous server.

I think this is similar to the event store in this way.

The downside is that its API differs significantly from Python's socket / threading module; You must rewrite a reasonable bit of your application (or write a compatibility shim layer)

Edit: It seems that there is also, which is similar, but Python 2.5 uses the enhanced generator for its correlation instead of greenlets, making it more portable than the consent and other options, the network I / O is directly done with Ipol / Keku / IoPp.


No comments:

Post a Comment