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개 답변
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
전문가
답변함 4달 전
  • 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.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠