3 ms·
"While this sounds easy in theory, it is rather difficult to pull off on most stacks." Why is it difficult on most stacks? Because it's tying up a request hand
by jey 16y ago
"While this sounds easy in theory, it is rather difficult to pull off on most stacks."
Why is it difficult on most stacks? Because it's tying up a request handling thread?
- felixge 16y agoBecause most stacks don't have a single threaded, non-blocking I/O event loop. Sure you can do this with threads, but it's gonna get very tricky to pump data between a socket, file and process using threaded programming.
- jey 16y agoFirst, I agree that it'd be silly not to use thread-per-CPU non-blocking I/O. However, I don't see why it'd be tricky in a threaded server. The thread gets an fd to recv() the incoming data from, and it popen()s an ffmpeg process then loops to recv() and write() the data until done.
- felixge 16y agoI'm not saying it can't be done. In fact the multipart parser we have build for transloadit has already been ported to C++ [1] and I imagine Java has decent libraries as well. But most people just sit on a request/response oriented Python/Ruby/PHP stack with possibly stupid buffering load balancing in between (nginx buffers uploads). If you build this from ground up, it is certainly possible with a lot of technologies. [1] https://github.com/FooBarWidget/multipart-parser https://github.com/FooBarWidget/multipart-parser