[英]Leveraging heroku in node.js
I've been looking for a PaaS provider for some time, nodejitsu seemed promising but doesn't offer some of the features I'm looking for. 我一直在寻找PaaS提供商一段时间,nodejitsu似乎很有前途,但没有提供我正在寻找的某些功能。 I need the ability to process a lot of data quickly for a lot of my requests.
我需要能够处理很多请求的快速处理大量数据的能力。 I'm off to a good start with node.js but what I'd like to do is fire off tasks to scrape web data, process some statistics(basically a roster) from databased information.
我从Node.js开始有了一个良好的开端,但是我想做的是解雇一些任务来抓取Web数据,从数据库信息中处理一些统计信息(基本上是名册)。
Basically I'm scraping peoples social media(Facebook, twitter, tumblr, etc.) to determine how much presentation they get on my web service, then serve their latest content(image and a short text) to the viewers. 基本上,我是在抓取人们的社交媒体(Facebook,Twitter,tumblr等),以确定他们在我的Web服务上获得多少展示,然后将其最新内容(图像和短文本)提供给观众。 In the end this creates a very large amount of operations per request because I need to compare statistics along many different artists.
最后,这会为每个请求创建大量操作,因为我需要比较许多不同艺术家的统计信息。
What I imagine doing is something like this: 我想象的是这样的:
This is the structure I desire to deploy on heroku, so I can use the processing dynos to free up web dynos so users are never waiting in the dark for a page to load. 这是我希望在heroku上部署的结构,因此我可以使用处理dynos释放Web dynos,这样用户就不会在黑暗中等待页面加载。 On high traffic some users may have to wait for the page to populate content, but in most cases the content will start populating soon after the page is rendered.
在流量较高的情况下,某些用户可能必须等待页面填充内容,但是在大多数情况下,内容将在呈现页面后立即开始填充。 If not the users who just intend to navigate to another page right away aren't stuck waiting for the site to finish responding to do so.
如果不是这样,仅打算立即导航到另一个页面的用户就不会等待网站完成响应。
So basically my question is how do I leverage worker dynos to free up web dynos in node? 所以,基本上,我的问题是如何利用工作人员的测功机释放节点中的Web测功机? Or is there a better way to do this?
还是有更好的方法来做到这一点?
Sorry for any sloppiness, this was type on my tablet. 对不起,这是我平板电脑上的输入。
Yes, Heroku is great for this sort of thing. 是的,Heroku非常适合此类事情。 See https://devcenter.heroku.com/articles/background-jobs-queueing
参见https://devcenter.heroku.com/articles/background-jobs-queueing
The missing component in your thinking is the use of a queue. 您认为缺少的组件是使用队列。 Resque with coffee-resque is probably the most widely used, but Kue is a great option for an all-Node solution.
Resque with coffee-reque可能是使用最广泛的方法,但是Kue是全节点解决方案的绝佳选择。 Both run on top of Redis.
两者都运行在Redis之上。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.