Re: [Twisted-Python] Deferred documentation rewrite

2009-07-30 Thread Nitro
Am 30.07.2009, 23:45 Uhr, schrieb Kevin Horn :

> Thanks for this, Terry.  I'd never thought of it that way, and it's  
> quite a
> good point.

I agree. I've come to think it's partially a fault of using normal text  
based editors. Those fit the programming models from 30 years ago well,  
but today lots of things are more involved. Text is linear and doesn't  
branch. Asynchronous code is more like a bunch of pipelines which can  
branch, melt together at points or are dead-ends. In my opinion a good  
code editor would visualize this for me, but so far I've never came across  
one which does this job.

-Matthias

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Twisted webserver performance issues

2009-11-08 Thread Nitro
Am 08.11.2009, 15:54 Uhr, schrieb Maarten ter Huurne  
:

> On Sunday 08 November 2009, James Y Knight wrote:
>
>> When I last looked into the performance issues, I found that sometimes
>> trac appears to block for long periods of time without releasing the
>> GIL. That seems to be the core of the performance issues, currently.
>> When it's responding normally, it's perfectly snappy. But, sometimes,
>> it blocks for 10sec at a time.

Some general documents about track + performance issues:

http://trac.edgewall.org/ticket/7490
http://trac.edgewall.org/wiki/TracPerformance

Lots of people experienced slow trac performance it seems. Reading through  
the #7490 ticket it seems there's a multitude of reasons for this. Maybe  
the twisted webserver suffers from one of them.

-Matthias

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Shared resource manioulation example

2010-05-28 Thread Nitro
Am 28.05.2010, 20:34 Uhr, schrieb :

> hi,
>
> Callbacks serialization is clear to me.
>
> I'll try to rephrase the question: two requests are incoming for  
> reactor()
> to handle. Each request has its own chain of callbacks.
> At some point one of the requests need to update the same
> global data structure, and another request need to delete from the same
> global data structure.
> So theoretically, correct me if I wrong, will be a data collision.
> If it is, than how can I prevent it? Example please.

It will go like this:

reactor loop:

1) receive Event A
- fire deferred callback
- deferred callback does data[key] = value
2) receive Event B
 - fire deferred callback
 - del data[key]

So one event is processed after another. Determining if it's a data  
collision is up to you. E.g. you could use something like a revision  
number. Each time you change the dictionary, increase it by one. Then if  
you try to change the dictionary and the client gave a different revision  
id then the last one, you know there is a collision.
What you do sounds very much like database transactions. Those are not  
easy to do. One example is the ZODB which can do what you want. For  
example via BTrees. But I guess there are more lightweight systems which  
do what you want, too. It all depends where you want to go with your app.  
That's up to you though and not really a question in regards to twisted or  
networking.

-Matthias

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python