Micro Services and noSQL - Best practices for enriching data in microservice architecture

I want to plan a solution that manages rich data in my architecture.
To be more clear, I have dozens of microservices.
let them say - the country, the building, the floor, the worker.
Everything works on a separate NoSql data warehouse.

When I receive data from the employee service, I also want to provide the gender name (worker works), the name of the building and the name of the country.

Solution1.
The client will request all microservices.
The problem is multiple requests and informing the client about the structure.
I know that several requests should not bother me, but I think it is better to use json describing the object in one call.

Solution 2:
Create an orchestration that retrieves data from multiple services.
The problem is if the data (object names, for example) are not stored in one document in the database, it is very difficult to sort and filter these fields.

Solution 3.
Before saving the object, for example. employee, call all other services and fill in the relevant data (building name, country name).
The problem is when the name of the building is changed, it is not reflected in the workplace.

4.
( , ).
, . .
, , , , .
: , . , ( ), .

5.
. Fileter ElasticSearch. : ES

+4
4

N, :

  • . , URI.

  • , , , . ( URI)

  • CAP , CAP. CA? CP? , , AP? .

  • " " MapReduce, .

  • /. URI, , URI (, ..), . , . , , . .

  • , , , .

  • , JSON. () , JSON.

NoSQL, Riak: CAP, IIRC. , . (, , )

+1

, , Netflix ( ), . , , , , , , , .

, .

, , 2. , 2, / . , NoSQL, - , . , , , , , , ( @Roman Susi 1 2), . , , , .

, , .

, (https://www.youtube.com/watch?v=StCrm572aEs)... , .

+1

, . : ? , :

1: , //. , 2 - 10 . , , .

2: 1, , , , ,

3: , - .

4. . :

  • . 20 , x20.
  • . 20 → 20
  • . . - .
  • . , , .

5: : -)

. , .

, , 2.

- , ! , ES, . , ES - , .

+1

, .

Floor URI () . URI.

JSON-LD :

worker = {
  '@id': '/workers/87373',
  name: 'John',
  floor: {
    '@id': '/floors/123'
  }
}

floor = {
  '@id': '/floor/123',
  'level': 12,
  building: { '@id': '/buildings/87' }
}

building = {
  '@id': '/buildings/87',
  name: 'John home',
  city: { '@id': '/cities/908' } 
}

Thus, all the client needs to do is add a BASE URL (e.g. api.example.com) to @id and make a simple GET call.

To remove additional load from the client (in the case of a slow mobile device), we use a gateway template with microservices. The gateway can expand these links with very little effort and increase the return object. It can also make multiple calls in parallel.

Thus, the gateway will make a call to GET / floor / 123 and replace the outdoor object with an answer.

+1
source

All Articles