简体   繁体   中英

how should microservices talk to each other in docker

I have a Rails app which I moved to docker. The process forced me to split the app into 2 microservices: the main app and an address verification microservice. I encapsulated the address verification microservice into another Rails app which my main app calls. It uses rest-client and it blocks until it receives a response.

Requests used to be processed in 300ms. Now, they take 1.3s. After looking at the newrelic data, it seems the bulk of the time is spent in the main Rails app calling the address verification Rails app. Is there a way microservices should communicate between containers? I guess my question is Ruby/Rails specific. Should I look into RabbitMQ? The problem is that I need a verified address very early into the flow, so I'm not sure how much time an asynchronous request to the address verification microservice Rails app will buy me.

新数据

It turns out that the address verification microservice had a problem. I had enabled devise on the address verification and the user find/update actions were taking a lot of time. I'm still not sure why they were taking so long, but soon as I disabled them, I went back to decent numbers. I'll need to find out what the hell was happening with devise. It's still not what I had with internal calls, but docker & microservices is not that terrible.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM