Re:Vapor: a type-safe web framework for Swift
by eddd on Sunday February 21, 2016 @05:09AM
(#11143977)
But why? Why would you create a web framework in a single-thread environment? This line of code: https://github.com/tannernelson/vapor/blob/master/Sources/Se... - makes this framework totally useless.
[ Parent
| on HN ]
Re:Vapor: a type-safe web framework for Swift
by gilgoomesh on Sunday February 21, 2016 @08:48AM
(#11144473)
The server isn't single threaded. It uses the dispatch concurrent thread pool for processing. The (granted, ugly) line you've linked is for blocking and keeping the main thread alive so the process doesn't end. However, the requests are processed on the dispatch "Background" queue. See "boot" here:
https://github.com/tannernelson/vapor/blob/master/Sources/So...
Re:Vapor: a type-safe web framework for Swift
by goldenkey on Sunday February 21, 2016 @06:09AM
(#11144066)
Do you realize that node.js is single threaded?
Having more than one process works fine for most purposes. Because the bottlenecks are more IO driven than CPU time.
Re:Vapor: a type-safe web framework for Swift
by eddd on Sunday February 21, 2016 @06:51AM
(#11144155)
Please check the function I am referring to.
Also, yes, I think concurrency model in node.js is the worst possible one.
Re:Vapor: a type-safe web framework for Swift
by goldenkey on Sunday February 21, 2016 @07:03AM
(#11144187)
I saw it. It's just a function to keep the main thread, ie. main() alive while the worker threads process the async events. Nothing out of the ordinary..
Re:Vapor: a type-safe web framework for Swift
by EGreg on Sunday February 21, 2016 @09:36AM
(#11144630)
And why is it the worst possible one? Preforked threads per request are much worse as NGinX showed Apache
Re:Vapor: a type-safe web framework for Swift
by tannernelson on Sunday February 21, 2016 @11:59AM
(#11145240)
This line is just meant to keep the process alive. The actual implementation of the ServerDriver uses threads. It's also worth mentioning that Vapor is totally protocol-based and modular, so you can easily plug in any class that conforms to ServerDriver and replace this logic.
Re:Vapor: a type-safe web framework for Swift
by cellularmitosis on Sunday February 21, 2016 @11:42AM
(#11145148)
Because it would be nice to run a web server on my phone? I'd love to have something like sandstorm in my pocket.