If the crypto prices are in the DB, the parser would have to issue a lot of queries during parsing to figure out the prices.
And, when importing the new prices from exchanges, we'd have to create Flyway script for the new updates, which will pile up.
The more DB traffic you do on Aurora, the more you pay, so here's what I did.
The historical prices of all cryptos are stored in CSV files that are updated periodically by an integration test.
Another integration test parses the CSV files and imports all prices into an in-memory CryptoFxRatesRegistry.
The CryptoFxRatesRegistry is then serialized and saved into a file.
When the app starts, the CryptoFxRatesRegistry is instantiated, and the crypto prices are loaded from the file the CryptoFxRatesRegistry.bytes that stored the serialized content of the CryptoFxRates.
This way, whenever the parser needs a crypto price, it gets the value from memory, not from the DB.
This is both faster and cheaper, as the processing is done at built-time, and in production, we are using the cached prices.
Keep It Simple!
β’ β’ β’
Missing some Tweet in this thread? You can try to
force a refresh
I've been blogging constantly for almost 9 years now, so here's a list of tips I've discovered all along:
1. Just do it! If you are waiting for the right time to start blogging, you will never do it.
2. Keep it simple! I started either WordPress.com and it worked liked a charm since I can focus on content creation while Automattic takes care of backups, caching, security updates, and failover.
3. Focus on things you discover doing your job. That's how I started blogging about Spring and Hibernate.
You can write a software book and make over 100k $
Here's what worked for me:
1. I started a blog first. This allows you to practice your writing and build an audience.
2. I self-published my book because publishers only wanted to give me just 10% from the profit.
I used @leanpub to write and sell the book while I was still writing it and @teachable to sell it when it was done.
Leanpub gives you 80% royalties. Teachable gives you around 95%.
3. As a non-native English speaker, I used @Grammarly to correct my English spelling mistakes. I'm a huge fan of Grammarly and been their customer ever since.