Summary
Twisted is an open source framework for writing network based services. It utilises an asynchronous, event driven model which allows the rapid development of custom network protocols. While Twisted makes implementing network services much easier, it comes with its own set of challenges. One of these challenges involves tracking the context of multiple requests. In a traditional web server the thread ID could be used to track a particular request and modify log entries appropriately. However, this does not work in Twisted as it utilises a single thread (generally speaking). We have chosen to tackle this issue, amongst others, by monkey patching some of the Twisted subsystems. Through this talk we will introduce Twisted as a viable option for programming network based services. No previous Twisted knowledge is required, and the concepts introduced will be explained through real world examples of restful controllers implemented in Twisted. This primer will be followed by a discussion on our solution to the context tracking problem as well as some of the other areas in which we have found monkey patching to be beneficial.