istanbulhs / presence

Wireless'a bağlı cihaz olup olmadığını kontrol eden basit bir betik.
5 stars 3 forks source link

Çözüm paralel sorgulamaları desteklemiyor #3

Closed aouyar closed 11 years ago

aouyar commented 11 years ago

Varolan çözüm single-threaded ve synchronous bir sunucu implementasyonu kullandığı için birden fazla paralel sorguyu desteklemiyor ve yavaş çalışan tek bir sorgu veya bağlantısı sorunlu olan tek bir kullanıcı, servisi diğer tüm kullanıcılar için bloke edebilir.

Python SocketServer dokümentasyonunda bu durum çok güzelce açıklanmış:

"These four classes process requests synchronously; each request must be completed before the next request can be started. This isn’t suitable if each request takes a long time to complete, because it requires a lot of computation, or because it returns a lot of data which the client is slow to process. The solution is to create a separate process or thread to handle each request; the ForkingMixIn and ThreadingMixIn mix-in classes can be used to support asynchronous behaviour."

Kısaca bu servisin sık sık bloke olmasını engellemek için mutlaka ya Multi-process, ya Multi-Threaded veya Asynchronous I/O kullanacak şekilde geliştirilmesi gerekiyor.

plq commented 11 years ago

bu kadar seyi yazacagina bir yama gonderseydin ya arkadasim :)

ben bastan yapayim sunu dur.

aouyar commented 11 years ago

Sen elini çabuk tutmazsan dayanamayıp da ben de yapabilirim zaten. ;-)