简体   繁体   English

将Node JS和Python结合在一起用于CPU和IO密集型Web应用程序

[英]Combining Node JS and Python for CPU and IO intensive web applications

Node JS seems to be a perfect fit for serving fast lightweight requests asynchronously. Node JS似乎非常适合异步地处理快速的轻量级请求。 However, i'm not convinced that it is a good fit for intensive background work - despite the ability to deploy Node JS in a clustered fashion. 但是,尽管可以以群集方式部署Node JS,但我不认为这适合进行密集的后台工作。

I am considering using Node JS to interact with my template rendering engine (Express) and serve requests by building up a range of lightweight micro-services in Node. 我正在考虑使用Node JS与我的模板渲染引擎(Express)交互并通过在Node中建立一系列轻量级微服务来服务请求。 Further, I am then considering having Node JS pass off intensive work to Python (perhaps via some kind of in-memory technology such as Redis or a dedicated Task Queue). 此外,我然后考虑让Node JS将繁重的工作传递给Python(也许通过某种内存技术,例如Redis或专用的Task Queue)。 I am familiar with Python and in particular, multi-threading. 我熟悉Python,尤其是多线程。

For example, on a 4 core machine, I might have two cores dedicated to running load balanced background tasks and 2 cores dedicated to a Node JS cluster. 例如,在一台4核计算机上,我可能有两个专用于运行负载平衡后台任务的核心和两个专用于Node JS集群的核心。 Would this be a vaguely sensible approach in comparison to trying to "Javascript all the things"? 与尝试“用Java编写所有内容”相比,这是一种模糊的明智方法吗?

您可以使用消息队列,例如RabbitMQ。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM