本文介绍了Twitter4j 慢速状态流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够使用 onStatus() 方法根据关键字流式传输趋势推文.最初,推文的传播速度很快.现在他们的流媒体播放速度似乎很慢.有没有其他人遇到过这个问题并有解决方案?

I was able to stream trending tweets based on keywords using the onStatus() method. Initially, the tweets were coming in at a fast rate. Now they appear to be streaming very slow.Has anyone else had this issue and have a solution?

推荐答案

来自这里:

缩放

Twitter 流媒体量不是恒定的.在 24 小时的整个过程中,每秒传递的推文数量会自然潮起潮落.此外,数据量逐月稳定增长,重大的世界或文化事件可能导致流量峰值达到当前每日峰值量的 3 倍或更多.想要保持连接的客户端必须针对这些情况进行配置和测试.

Twitter streaming volume is not constant. Throughout the course of a 24 hour period, there is a natural ebb and flow to the number of Tweets delivered per second. In addition, the amount of data grows steadily month-over-month, and significant world or cultural events may cause traffic spikes of 3 or more times the current daily peak volume. Clients which want to maintain their connections must provision and test for these cases.

摄取推文和其他流消息的最佳做法是将大量流的收集和处理分离.例如,在一个进程中收集消息的原始文本,将每条消息传递到消息队列、旋转平面文件或数据库中.第二个进程或一组进程应该解析消息并提取任何必要的字段以进行存储或进一步操作.

The best practice for ingesting Tweets and other streaming messages is to decouple collection and processing of high volume streams. For example, collect the raw text of messages in one process, passing each message into a message queue, rotated flatfile, or database. A second process or set of processes should parse the messages and extract any necessary fields for storage or further manipulation.

这篇关于Twitter4j 慢速状态流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 00:05