DEV Community

Katappa Kautilya
Katappa Kautilya

Posted on

Handling large amount of requests with map editing

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?

Top comments (0)