Alex Xu Profile picture
Jan 4 โ€ข 7 tweets โ€ข 3 min read
/1 How can Redis be used?

There is more to Redis than just caching.

Redis can be used in various scenarios, as shown in the diagram. Image
/2 ๐Ÿ”นSession
We can use Redis to share user session data among different services.

๐Ÿ”นCache
We can use Redis to cache objects or pages, especially for hotspot data.

๐Ÿ”นDistributed lock
We can use a Redis string to acquire locks among distributed services. Image
/3 ๐Ÿ”นCounter
We can count how many likes or how many reads for articles

๐Ÿ”นRate limiter
We can apply a rate limit for specific user IPs

๐Ÿ”นGlobal ID generator
We can use Redis Int for global ID

๐Ÿ”นShopping cart
We can use Redis Hash to represent key-value pairs in a shopping cart Image
/4 ๐Ÿ”นCalculate user retention
We can use Bitmap to represent the user login daily and calculate user retention.

๐Ÿ”นMessage queue
We can use List for a message queue.

๐Ÿ”นRanking
We can use ZSet to sort the articles. Image
/5 ๐Ÿ‘‰ Over to you: Have you used Redis for other use cases? What are they?
/6 ๐’๐ฎ๐›๐ฌ๐œ๐ซ๐ข๐›๐ž ๐ญ๐จ ๐จ๐ฎ๐ซ ๐ฐ๐ž๐ž๐ค๐ฅ๐ฒ ๐ง๐ž๐ฐ๐ฌ๐ฅ๐ž๐ญ๐ญ๐ž๐ซ to learn something new every week:

bit.ly/3FEGliw
/7 I hope you've found this thread helpful.

Follow me @alexxubyte for more.

Like/Retweet the first tweet below if you can:

โ€ข โ€ข โ€ข

Missing some Tweet in this thread? You can try to force a refresh
ใ€€

Keep Current with Alex Xu

Alex Xu 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 @alexxubyte

Jan 2
/1 How does Git Work?

The diagram below shows the Git workflow.
/2 Git is a distributed version control system.

Every developer maintains a local copy of the main repository and edits and commits to the local copy.

The commit is very fast because the operation doesnโ€™t interact with the remote repository.
/3 If the remote repository crashes, the files can be recovered from the local repositories.

๐Ÿ‘‰ Over to you: Which Git command do you use to resolve conflicting changes?
Read 4 tweets
Dec 29, 2022
/1 Evolution of Uberโ€™s API layer

Uberโ€™s API gateway went through 3 main stages.
/2 First gen: the organic evolution. Uber's architecture in 2014 would have two key services: dispatch and API. A dispatch service connects a rider with a driver, while an API service stores the long-term data of users and trips.
/3 Second gen: the all-encompassing gateway. Uber adopted a microservice architecture very early on. By 2019, Uber's products were powered by 2,200+ microservices as a result of this architectural decision.
Read 7 tweets
Dec 28, 2022
/1 Can a web server provide real-time updates?

An HTTP server cannot automatically initiate a connection to a browser. As a result, the web browser is the initiator. What should we do next to get real-time updates from the HTTP server?
/2 Both the web browser and the HTTP server could be responsible for this task.
/3 ๐Ÿ”นWeb browsers do the heavy lifting: short polling or long polling. With short polling, the browser will retry until it gets the latest data. With long polling, the HTTP server doesnโ€™t return results until new data has arrived.
Read 7 tweets
Dec 27, 2022
/1 Why is a credit card called a โ€œ๐œ๐ซ๐ž๐๐ข๐ญโ€ card?

Why is a debit card called a โ€œ๐๐ž๐›๐ข๐ญโ€ card?

An example of a debit card payment is shown in the diagram below. ๐Ÿ‘‡
/2
๐Ÿ”ธ Each transaction in the business system is transformed into at least two journal lines in the ledger system. This is called ๐๐จ๐ฎ๐›๐ฅ๐ž-๐ž๐ง๐ญ๐ซ๐ฒ accounting, where every transaction must have a ๐ฌ๐จ๐ฎ๐ซ๐œ๐ž account and a ๐ญ๐š๐ซ๐ ๐ž๐ญ account.
/3
๐Ÿ”ธ Each journal line is booked to an account.
๐Ÿ”ธ Each account belongs to one of the three components in the balance sheet:

๐Ÿ’กAsset = Liability + Equity

Letโ€™s look at the issuing bankโ€™s ledger as an example:
Read 8 tweets
Dec 26, 2022
/1 What is cloud-native?

Below is a diagram showing the evolution of architecture and processes since the 1980s.

Organizations can build and run scalable applications on public, private, and hybrid clouds using cloud-native technologies.
/2 This means the applications are designed to leverage cloud features, so they are resilient to load and easy to scale.

Cloud-native includes 4 aspects:

๐Ÿ”น 1. Development process
This has progressed from waterfall to agile to DevOps.
/3 ๐Ÿ”น 2. Application architecture
The architecture has gone from monolithic to microservices. Each service is designed to be small, adaptive to the limited resources in cloud containers.
Read 8 tweets
Dec 22, 2022
/1 What tech stack is commonly used for microservices?

Below you will find a diagram showing the microservice tech stack, both for the development phase and for production.
/2 โ–ถ๏ธ ๐๐ซ๐ž-๐๐ซ๐จ๐๐ฎ๐œ๐ญ๐ข๐จ๐ง

๐Ÿ”น Define API - This establishes a contract between frontend and backend. We can use Postman or OpenAPI for this.
/3 ๐Ÿ”น Development - Node.js or react is popular for frontend development, and java/python/go for backend development. Also, we need to change the configurations in the API gateway according to API definitions.
Read 10 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!

:(