开发者

How to log impressions (and data) in Java for a javascript widget?

开发者 https://www.devze.com 2023-02-11 11:25 出处:网络
I 开发者_如何学运维have a javascript widget the loads JSON data from a Java webapp. I want to record impressions, and the ids of the data I return (5 or 10 longs).

I 开发者_如何学运维have a javascript widget the loads JSON data from a Java webapp. I want to record impressions, and the ids of the data I return (5 or 10 longs).

I want to be able to process these and give a summary of how many impressions a person got on their widget, and record how many times each piece of data was seen.

I'm guessing it's not a great idea to store it all in my postgres database since it could probably be a lot of data (perhaps tens of impressions per second).

Right now I'm considering just writing it all to a log file and processing it every hour.

Is there a better way? Maybe with some kind of message system, or event system?


Writing to log and processing off-line should be ok.

You can program your logging system to create hourly log files, then process files that are not written-to any more. You can do background processing in separate thread/process at low priority.


I'm not sure what you are after, but maybe it's a good solution to do call to an web-analytics (.e.g. Google Analytics) tool from the javascript part of your widget?

You won't have access to your raw data, but it will scale wonderful and you'll have nice graphs.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号