0

I'm trying to make a simple application on Tornado, and Tornado is an event driven Webserver, and because it's on Python, then i'll try to use Multiprocessing, but in what?

Password hashing is a linear operation no? if i hash a password 1000 times, then every n operation needs the n-1 operation?

What about image processing, if they are used in forms, then it must wait until the client validate his form no?

The only example i can get from multiprocessing is 3D Rendering, more you get processes, more you gain time.

Abdelouahab Pp
  • 4,252
  • 11
  • 42
  • 65

1 Answers1

2

Why would you need multiprocessing and add a hell of complexity to your purpose while there is no actual need? If you want to take advantage of multiple cores, just raise some Tornado instances behind Nginx. For trivial tasks like hash computations, template renderings etc the overhead is more than acceptable. If you have more complex scenarios, delegate your work to a queue, such as celery.

Hashing is an O(n) operation, but that doesn't mean you need previous calculations to compute a hash every time. Also, 3D rendering doesn't take place on the server :)

hymloth
  • 6,869
  • 5
  • 36
  • 47
  • 3D was just an example, because i come from CGWorld, and web application is a new stuff :p so then, event driven dont need multiprocessing/threading? – Abdelouahab Pp Feb 21 '13 at 12:14
  • 1
    Short answer: yes, do not mix those different worlds. Keep your event-driven servers do what they are supposed to do (mostly async i/o operations) and use a queue for more demanding tasks. – hymloth Feb 21 '13 at 12:32