Reputation: 1182
we have micro-services design and we have DocumentService
and DocumentReportService
.
DocumentsService
- get documents, search documents in ELK.
DocumentsReportsService
- generate reports in doc, export into PDF and e.g. and I want to use ELK as storage again.
Question: ELK for DocumentsService
and DocumentReportService
it is 1 ELK instance or 2?
Upvotes: 2
Views: 1983
Reputation: 10693
If your question is whether to use same ES cluster for both services or separate cluster for each then-
I would advocate for the statement “there is no such thing bad design”. Design should always complement your requirement and at the same time should be simple enough to understand. Remember the KISS design principle.
Microservices supports both the patterns for database
Both has its pros and cons. But the thing that should not be left out or neglected while designing in microservices is bounded context.
In your case I guess a simpler version of design could be keeping boundaries well defined:
Document service: takes the primary responsibility of interacting with Document store (in your case Elastic search). It is the services that retrieve and if need stores the document in the document store. Keeping document-service the only one interacting with the document store gives you an advantage of your other services do not need to bother about how and where documents are being stored. Other services just know one service that encapsulates the responsibility of providing and storing documents. If in future you want to change your document store, it can be easily changed without impacting any other service in your landscape. (as compared when many services are interacting with your data store and if you want to change the store all those services have to incorporate the changes). So, you see how bounding the context made your design extensible.
Reporting service: takes responsibility of generating a report. It encapsulate whole business logic of creating complete reports (only generating). This service doesn’t know how are where documents/reports are being stored. (This service is only confined of generating reports not storing reports)
Upvotes: 3
Reputation: 118
DocumentReportService should use DocumentService instead of his own ES.
Also ELK is Elasticsearch, Logstash, Kibana
Upvotes: 2
Reputation: 5259
I assume, your question is whether to use same ES cluster for both services or separate cluster for each.
In Microservice architecture, it is considered a bad practice to "share the database" - in practice what is meant is that multiple services should not access same database objects as it will lead to tight coupling between them. It is quite possible that multiple services might still make use of same physical instance of the database.
So in your case, if both services use separate index and mapping in ES, they could be using same cluster. What you should avoid is both services read and write to same mapping as it will lead to tight coupling.
Upvotes: 0