4 ms·
I like what Deno is doing, it also has a bunch of great features. The functionality of it is great and the execution is sharp. However, my main gripe with Deno
by commitpizza 4y ago
I like what Deno is doing, it also has a bunch of great features. The functionality of it is great and the execution is sharp.
However, my main gripe with Deno is that it's tied to one company and it won't solve issues that it doesn't have. As an example of this, a version of nodes cluster module is not supported so there is no way of running one deno process per cpu which is very bad if you're hosting it yourself and want to utilize the full potential of your hardware.
It also means that if your app is bound to some CPU heavy action, like generating a large excel-file or similar, your app will go down since no requests will be processed due to the single thread nature. Of course, such actions can be solved with a web worker but what if you make a coding mistake which renders an unhandled exception? In this case the app would probably go down and if the end user for example does the same action over and over again (which end users tend to do in frustration), the app will go down again and again.
Deno as a company has probably little interest in solving this as the solution is to run it on their paid service. You could of course have several servers hosting the app, but that gets expensive real quick especially if you are a small shop. Another example is to run the entire app process as web workers but then you need to spin up many processes that all have their own ports which you need to add a load balancer in front of it. This is kind of advanced and adds unnecessary complexity to the app IMO.
Also, if Deno the company company fails, what then will happen to Deno the project?
- homeland221 4y agoSimilar with MySQL. As long as the code is open sourced...I'm ok with it...heck MySQL managed to turn into MariaDB and yet many still stick MySQL.
- spion 4y agoregarding multiprocess, I think solutions such as kubernetes and similar are the way to go (rolling restarts / updates, autoscaling, advanced load balancing etc) rather than having it managed within the runtime libs > what if you make a coding mistake which renders an unhandled exception? AFAIK unlike node, Deno's API is largely promise-based and therefore all unhandled exceptions should become unhandled rejections withou crashing the process - so this should be less of an issue than it is with node (Of course, using older node libraries makes crashes more likely)
- tempest_ 4y agoThere is an ocean of distance between wanting to use all the cores on a CPU and spinning up (or paying for) the monster abstraction that is kubernetes.
- spion 4y agoJust as a point of full disclosure, I'm the author of recluster (https://github.com/doxout/recluster https://github.com/doxout/recluster) and its accompanying modules (such as https://github.com/spion/sticky-listen https://github.com/spion/sticky-listen) and I also have some experience with managing k8s by myself - so I have some experience with both approaches.
- commitpizza 4y ago> AFAIK unlike node, Deno's API is largely promise-based and therefore all unhandled exceptions should become unhandled rejections withou crashing the process - so this should be less of an issue than it is with node Perhaps you're right, I have not tried this out in Deno-land so I cannot say wether this actually applies to Deno the same way. I just know that I got burned by this exact issue in node and I think this can be a security issue that people usually don't really think about. If you know that some api is a node api, if you manage to find a bug that is crashing the process one could probably script it to trigger it to crash over and over again. Even if it restarts quickly, usually it takes a second or and in that time one could bring the entire api down. I am not aware of any instance that this have been used against some api in practice but most other languages handle this much better than node does and the javascript way of crashing on error is one of the things that made me question using javascript for backend services at all. Regarding the kubernetes... no thanks. I would not go into that beehive unless forced. I didn't like the complexity increase of adding a load balancer and that is like a drop in the ocean of the complexity that is kubernetes.
- joelg236 4y agoYou can use PM2 with Deno
- doorman2 4y agoYou could solve the resource starvation issue by running multiple instances of your app and binding to a port using the SO_REUSEPORT option. This will allow multiple instances of your app to use the same port. This option is also quite good for deployments as you can have instances stop reading from the port while client traffic is still being served from other instances on the port. This works well for HTTP requests, but less so for something like gRPC.
- commitpizza 4y agoJust out of curiosity, how would you configure that in a systemd configuration file?
- doorman2 4y agoYou use the setsockopt system call. This is an example in C: int sfd = socket(domain, socktype, 0); int optval = 1; setsockopt(sfd, SOL_SOCKET, SO_REUSEPORT, &optval, sizeof(optval)); bind(sfd, (struct sockaddr *) &addr, addrlen); In Go, you can use syscall.SetsockoptInt. Most languages have a way of setting this option. You have to create the socket yourself and pass it into your HTTP server in most cases, but it depends on the library. Edit: oh sorry, you meant when systemd is opening the port for you. It looks like you can set ReusePort=yes in your configuration? https://www.freedesktop.org/software/systemd/man/systemd.socket.html https://www.freedesktop.org/software/systemd/man/systemd.soc...
- jbaczuk 4y agowhy not just build multithreading into deno? Is this only a paid feature?
- hayd 4y agoThere was some discussion of using rayon for CPU heavy ops... I'm not sure what makes excel generation CPU-intensive and blocking? (I wonder if it can stream.)
- deleted 4y ago[deleted]