AI RAG microservices architecture design pattern

0

Hi!

I'm building a stack of microservices with Java and SpringBoot to hold the main logic of my AI RAG service using langchain4j and Bedrock. For now since I'm starting I'm building one microservice that will hold the data ingest logic from the documents uploaded by the users. This documents will be saved in an S3 bucket and also transform to embeddings and saved in the DB. Then in this service I will put also the logic of the chatbot so the users can get the response of their answers when they send the requests.

Should I separate this and create one microservice for the data ingest and another one for the chatbot Q&A logic to avoid performance issues in the future?

Thanks!

1 Resposta
1

Hi,

For multiple reasons, you want to have multiple microservices and keep them small and loosely coupled. It's all about separation of duties.

Seehttps://medium.com/@chkamalsingh/microservices-core-principles-80e427261bc8 for best practices

Having small microservices (which is a pleonasm ;-) ) has multiple advantages on the side of NFRs (Non-Functional Requirements):

  • better security: the execution roles associated to lambda can have reduced privileges
  • performances and scalability can be managed in a more granular fashion
  • high-availability: you can have different strategies for your different microservices.

Yes, it's more work upfront but, if you build for the long-term, it will pay back multiple times over the course of the life of your service.

Best,

Didier

profile pictureAWS
ESPECIALISTA
respondido há 8 meses
  • I see! Thanks man! One final question, if my chatbot microservice needs to access the db to get some data, it should call the main data ingest microservice that is inserting the data into the DB to get the response. Or should the second microservice also map the db and the same table to get that data directly without calling the data ingest microservice?

  • My take is that you should keep the ingest service independent from read requests: you can separate concerns and avoid write permission when unneeded. So, it is better from my standpoint to reads from the chatbot service.

  • I see, thanks man!

  • Interesting project that you are building with leading-edge techs! Good luck. Thanks for accepting my answer.

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas