5 ms·
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/Serve
by eddd 11y ago
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/Server.swift#L136 https://github.com/tannernelson/vapor/blob/master/Sources/Se... - makes this framework totally useless.
- goldenkey 11y agoDo 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.
- eddd 11y agoPlease check the function I am referring to. Also, yes, I think concurrency model in node.js is the worst possible one.
- gilgoomesh 11y agoThe 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/SocketServer.swift#L21 https://github.com/tannernelson/vapor/blob/master/Sources/So...
- cellularmitosis 11y agoBecause it would be nice to run a web server on my phone? I'd love to have something like sandstorm in my pocket.
- mpweiher 11y agoYou can already do that.
- tannernelson 11y agoThis 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.