I've recently moved from python to node and Im enjoying it however it doesn't support multithreading. I'm working on a project that entails webscraping and automating using electron. I want to make a web app that can withstand hundreds of users without effecting the performance too much as speed is extremely important. Is Golang a better language for this compared to node?
评论:
Muchoz:
afghanPower:My brother is working on a web scraper of the dark web which is written in Go because of the performance. I myself am working on others stuff in Go and if you're looking for performance in backend development, then you're probably not gonna get the performance anywhere else. I'm no Javascript fan so I would recommend anything over Javascript really. I also came from (and am still doing) Python development and Go's concurrency is unmatchable imo.
mixedCase_:I would argue Clojure's handling of concurrency is at least as good. (Not much of a surprise since it's heavily inspired by Go).
cheesechoker:There are Go libraries for handling your usecase. Performance-wise and not-being-goddamned-Javascript-wise, Go does better than Node.
redditbanditking:Node.js can be competitive if your app is basically waiting on network I/O most of the time, and performs minimal CPU-bound processing. The event loop + callback/promise style of programming can be tedious, but with some care, it should easily support hundreds of simultaneous users.
On the other hand, if your app needs to perform any actual crunching of data, you'll need to deal with multiple servers or processes to stay responsive in Node. Managing these can be a pain, and Go quickly begins to look like a more natural choice.
rco8786:Go will definitely be faster, but I would like to caution you a little bit that you do have to handle the concurrency yourself. You don't just simply get it by switching to Go. Concurrency programming requires mastery of its own, and if you are not used to it, it can get hairy pretty quick.
iends:In this sub most folks will say Go. In the node sub most folks will say Node. Either will likely work just fine.
jgillich:Both platforms can easily handle hundreds of users. Node is a bit quicker of a platform to develop on, but it costs you more in the long run in maintenance. If your team size is > 3 I think Go clearly wins.
fwiw, I've found working with SQL DBs in Go unpleasant compared to scripting languages.
Disclaimer: I lead a team of Node developers, but would like to transition to Go.
:I'd probably go with Node, it has many tools and frameworks for web automation. To my knowledge, Go is generally faster and easier to scale, but the difference is not that much.
You can achieve "multithreading" in Node by running multiple processes, see the cluster module and process managers like pm2.
devmach:[deleted]
I think the idea with node cluster module is not killing process after it's done but have N amount of child processes running all the time and they being handling operations. Therefore, forking happens only at the app start-up.
