mgilliland23 / quantla

Quantla is a node powered crypto currency trading bot
5 stars 2 forks source link

Change the way data is being delivered to front end #63

Open mgilliland23 opened 5 years ago

mgilliland23 commented 5 years ago

Currently each end user is making a query to the database to get the decision, news, price and fundamentals data. In production this will be very expensive. We need to have a backend API that queries the database every 5 minutes and writes that data to a json file on the server. This json will then be served to the end users

costargc commented 5 years ago

instead of changing the server side... solution here is to implement aws CloudFront Distribution to cache information. The idea here is that limit the client request to he server side by caching out the response from the server and setting "Minimum TTL"

The minimum amount of time, in seconds, that you want objects to stay in CloudFront caches before CloudFront forwards another request to your origin to determine whether the object has been updated. Minimum TTL interacts with HTTP headers such as Cache-Control max-age, Cache-Control s-maxage, and Expires and with Default TTL and Maximum TTL.

costargc commented 5 years ago

Elastic Beanstakj (live nodejs):

ELB Load Balancer (http > https):

cloudfront (cache)

We are now pointing our DNS in Route 53 to present the cloudfront (cache) link instead of the live or the load balance one.

costargc commented 5 years ago

route 53 DNS routing users to dfwvog4klj3bu.cloudfront.net this is set to cache for 60s I'll test if this solved the issue once DNS gets updated.