Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

too many requests to CloudWatch #173

Closed
yegor256 opened this issue Jun 3, 2014 · 14 comments
Closed

too many requests to CloudWatch #173

yegor256 opened this issue Jun 3, 2014 · 14 comments

Comments

@yegor256
Copy link
Owner

yegor256 commented Jun 3, 2014

We've sent 18 million requests to AWS CloudWatch over the last 30 days. This is too many.. They simply cost too much. Let's find a way to send less. Maybe we should collect data locally (in files) and send only hourly summaries to CW.

@davvd
Copy link

davvd commented Jun 3, 2014

I'll ask someone to take care of this task soon

@davvd
Copy link

davvd commented Jun 3, 2014

@yegor256 thanks for the ticket, your account was topped for 15 mins, payment 000-cc24bf87

@davvd
Copy link

davvd commented Jun 3, 2014

@carlosmiranda it's your task now, the budget is 30 mins, go ahead

@carlosmiranda
Copy link
Collaborator

@yegor256 , for us to accomplish this we'd need to redesign the way the system is sending data to CloudWatch. At the very least, I'm thinking that we need to do the following:

  1. DefaultHost should locally log data for each request instead of sending data directly to CloudWatch.
  2. Create a scheduled job that consolidates the logs, makes a request to CloudWatch (one request per domain), and cleans up after.

It's a pretty big job and I suggest we do 1) first, and continue with the rest with PDD. For that, I'd ask, what format should the data be stored, and where?

@yegor256
Copy link
Owner Author

yegor256 commented Jun 6, 2014

Yes, I agree. Let's use H2 database in a directory?

@yegor256
Copy link
Owner Author

@carlosmiranda it's an urgent problem, would be great if you can focus on it

@carlosmiranda
Copy link
Collaborator

@yegor256 , sure, sorry, I've got my hands full lately. Could you give me a couple of days?

Also, just to make things quick, here was what I was planning to implement so that you can review/critique:

  1. An interface DomainStatsData, with methods void put(Domain, Stats) that will log the stats for each domain, including a timestamp, Stats get(Domain) that will get stats for each domain, and Map<Domain, Stats> get() for getting stats for all domains.
  2. An implementation H2StatsData that uses an H2 file-based database. It will contain a static DataSource field which will be used for the read/write operations. We will write to a database /domainStats
  3. DefaultResource will post data DomainStatsData instead of AmazonCloudwatch in DefaultResource
  4. Puzzles will be left for the implementation of the batch job that will periodically send data to Amazon Cloudwatch.

What do you think?

@yegor256
Copy link
Owner Author

@carlosmiranda sounds perfect, please go ahead

carlosmiranda added a commit to carlosmiranda/s3auth that referenced this issue Jun 11, 2014
carlosmiranda added a commit to carlosmiranda/s3auth that referenced this issue Jun 11, 2014
carlosmiranda added a commit to carlosmiranda/s3auth that referenced this issue Jun 11, 2014
carlosmiranda added a commit to carlosmiranda/s3auth that referenced this issue Jun 11, 2014
carlosmiranda added a commit to carlosmiranda/s3auth that referenced this issue Jun 11, 2014
@carlosmiranda
Copy link
Collaborator

I created a pull request for it at #177, please take a look.

carlosmiranda added a commit to carlosmiranda/s3auth that referenced this issue Jun 13, 2014
ghost pushed a commit that referenced this issue Jun 13, 2014
#177: pull request #173 Post metrics to local database to minimize CloudWatch API accesses
@carlosmiranda
Copy link
Collaborator

@yegor256 #177 is now merged to master, are we good here?

@yegor256
Copy link
Owner Author

yes, many thanks!

@davvd
Copy link

davvd commented Jun 17, 2014

@carlosmiranda Much appreciated! 30 mins was added to your account, payment ID 40929402

@davvd
Copy link

davvd commented Nov 18, 2014

puzzles in progress: 185-1d178b38/#192

@davvd
Copy link

davvd commented Dec 22, 2014

last puzzled solved 185-1d178b38/#192

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants