Handling large amount of requests with map editing
Katappa Kautilya
Posted on July 8, 2024
I am writing a Golang backend which is hit directly by android app.
I am storing app config data in Elasticsearch and and when a request comes i check in local cache if it is present and if not fetch from Elasticsearch. But i also want to update few fields of response so i am updating the response like
response.Hits.Hits[0].Source["current_time"] = utils.GetCurrentTimeInMillis()
It is throwing error:concurrent read and write. It can be handled with mutex lock but the number of requests will be approx, 200K per minute and because of this i am getting high api latency.
How can i handle it, can someone help?
💖 💪 🙅 🚩
Katappa Kautilya
Posted on July 8, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.