I would like to create a database to store how often access tokens in my system are being used.

I was thinking of a data model like so -

  • Access Token
  • from (basically I will store this hourly, so this will be the timestamp of teh start of the hour)
  • Number of times used

What would be the ideal database for this? I am conflicted with several choices.

Some more details to help out -

  • We get around 5k requests per minute, so the DB will have to be quick enough to update that.
  • We will not often be querying the database, probably only be looking for daily summaries and month end aggregations for accounting and auditing purposes.
  • We would prefer this to be on AWS as a service, but we can also spin up instances on our own.
  • Have you ruled out just storing the access (token, time, etc) and count them when needed? – Lennart May 31 '18 at 4:03
  • Sorry if something is not clear, but we need to count the number of requests that are sent per hour per access token? – Michael Victor May 31 '18 at 4:05
  • 1
    Well, if you store the request - whatever that is - together with the token, current_time etc you can count how many time each token have been used during a certain period of time. Having a counter for each token means that all usage of a particular token will have to update the same row. Furthermore, if you store aggregated data and someone requests that the reports should be on a 30 minute basis, that information is lost. – Lennart May 31 '18 at 4:14
  • Unfortunately, we do not store the request. It's a bit too much for us to store :( We are fine with only having hourly aggregates of this data. – Michael Victor May 31 '18 at 4:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.