September 15, 2017

一个请求到达tornado后如何被处理

异步非阻塞的tornado能够让同一台服务器接受更多的连接,服务更多用户,但对于每个用户来说,原本要等10秒才出现的浏览结果,现在至少还需要10秒,甚至可能还会慢一点,因为同样的硬件,现在有更多请求被接入进来。 Read more

February 9, 2017

speed up your pyres worker

We have a queue system for async works, it is build by Pyres with Redis. It works fine if your application is small, pyres worker forks a new process before doing job, and then terminate working process, worker just waits for new job. With out application is more and more complex, every new working process spends much time on loading, the package must be loaded, the package’s dependencies must be loaded, e. Read more

April 19, 2015

exception in python

My colleague remembered that if you pass some kwargs to an Exception subclass e.g. class MyException(Exception): pass, you will get a composed message when you catch the exception and call e.message. Unitil we got nothing from one place which it should display exception’s message, python language part is implemented by C, so we downloaded python source code(2.7.9), and find these lines. static int BaseException_init(PyBaseExceptionObject *self, PyObject *args, PyObject *kwds) { if (! Read more

Powered by Hugo & Kiss.