Vlad Mihalcea Profile picture
Aug 1 β€’ 7 tweets β€’ 3 min read
As a developer, we are always told to Keep It Simple, but what does that even mean in reality?

Here's a real-life example. πŸ‘‡
When I was developing RevoGain, I needed the historical prices of all the cryptocurrencies supported by #Revolut or #Kraken.

That's around 144 cryptos. So, most of you would store them in a DB, right?

Well, that would pose a lot of challenges.

revogain.com
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. Image
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. Image
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. Image
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
γ€€

Keep Current with Vlad Mihalcea

Vlad Mihalcea Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @vlad_mihalcea

Jul 13
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.
Read 10 tweets
May 19, 2021
9 High-Performance Tips when using PostgreSQL with JPA and Hibernate, a🧡
1. Use a SEQUENCE generator for entity identifiers. The Serial column type can affect the automatic batch INSERTs.

vladmihalcea.com/postgresql-ser…
2. Always enable automatic batching and instruct Hibernate to order INSERT and UPDATE statements.

vladmihalcea.com/how-to-batch-i…
Read 11 tweets
Jul 12, 2020
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.
Read 12 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(