App引擎中的记录器实体
在应用程序引擎中使用记录器实体来写入日志是否可行?我将有一个大约 1500req/sec 的应用程序,并且正在考虑使用任务队列来完成它。每当我收到请求时,我都会创建一个任务并将其放入队列中以向日志实体写入内容(具有日期和字符串属性)。
我需要这个,因为我必须将统计数据放入网站中,我认为这样做并稍后使用后端读取日志可以解决问题。如果我能够以编程方式访问应用程序引擎日志(通过日志记录),那就太棒了,但由于这是不可用的,我看不到任何其他方法可以做到这一点。
非常欢迎反馈
Is it viable to have a logger entity in app engine for writing logs? I'll have an app with ~1500req/sec and am thinking about doing it with a taskqueue. Whenever I receive a request, I would create a task and put it in a queue to write something to a log entity (with a date and string properties).
I need this because I have to put statistics in the site that I think that doing it this way and reading the logs with a backend later would solve the problem. Would rock if I had programmatic access to the app engine logs (from logging), but since that's unavailable, I dont see any other way to do it..
Feedback is much welcome
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有几种方法可以做到这一点:
您可能还想查看 Prospective Search API,它可以让您对日志数据进行一些过滤和预处理。
There are a few ways to do this:
You might also want to take a look at the Prospective Search API, which may allow you to do some filtering and pre-processing on the log data.
如何保留请求信息的 Memcache 数据结构(在请求到达时进行记录),然后每 5 分钟(或更快)运行一次 cron 作业,该作业处理来自 memcache 的最后 5 分钟请求的统计信息,并将这些统计信息记录在该 5 分钟间隔的数据存储。然后,相同(或不同)的 cron 作业也可以清除内存缓存 - 这样它就不会变得太大。
然后,您可以根据 5 分钟间隔统计数据的聚合运行全局分析,这可能比分析数小时的 1500req/s 数据更易于管理。
How about keeping a memcache data structure of request info (recorded as they arrive) and then run an every 5 minute (or faster) cron job that crunches the stats on the last 5 minutes of requests from the memcache and just records those stats in the data store for that 5 minute interval. The same (or a different) cron job could then clear the memcache too - so that it doesn't get too big.
Then you can run big-picture analysis based on the aggregate of 5 minute interval stats, which might be more manageable than analyzing hours of 1500req/s data.