简体   繁体   English

加速我的Rails应用程序,该应用程序使用Typhoeus发出多个Web服务HTTP请求

[英]Speed up my Rails Application which makes multiple web services HTTP requests using Typhoeus

My current application makes around 30 parallel HTTP requests for getting all sorts of data from various website's APIs and also scrap some content from some websites.I am using Typhoeus for it as i have heard that it rapid for making HTTP requests.But i desperately want to speed up my application, I have done research for it and got suggestions for turning the Typhoeus get requests to head requests where ever possible.I also implemented techniques for eager loading, solved N+1 problems.But still i need to quicken my application a lot. 我当前的应用程序发出了大约30个并行HTTP请求,以从各种网站的API中获取各种数据,还从一些网站中删除了一些内容。我正在使用Typhoeus,因为我听说它可以快速进行HTTP请求。为了加快我的应用程序的速度,我已经对其进行了研究,并提出了将Typhoeus获取请求转为可能的头请求的建议。我还实现了渴望加载的技术,解决了N + 1问题。很多。

Any suggestions welcome. 任何建议欢迎。

Thanks in advance. 提前致谢。

I've used resque before to handle a long running process in the background which greatly helped the site performance. 我以前使用过resque在后台处理长时间运行的过程,这极大地提高了网站性能。 If you are making those thirty parallel requests from the main process, it could slow things down quite a bit as I've read there are some issues with Ruby and threads. 如果您要从主流程中发出这三十个并行请求,这可能会使事情变慢很多,因为我读到Ruby和线程存在一些问题。

You could try and put the scraping code into a worker process and then set your page refresh to see the updates. 您可以尝试将抓取代码放入工作进程中,然后设置页面刷新以查看更新。

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

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