kavetiraviteja
kavetiraviteja

Reputation: 2208

Microservice architecture Flaws

We are facing performance related issues with microservice architecture.

Let's say there is microservice for user and account management. which have api's like

GET /users/{id} 
GET /users       (arrount 6 million users)

GET /accounts/{accountId}
GET /accounts 
and Other Operations on user and account

We have other microservice which track's user activities and list all the activities done by the user in his last login.

GET /user/activity/{userId}  (on an average 1000 to 10000 records)

We have protal for sales and marketing team to show individual user activities and user info and account info based on search criteria,

let's say search criteria is like : get all user activies who are located in colombia
Algorithm : 

1)Get /users ? location = colombia
2)then for individual user Get /user/activity/{userId}

it is like joining two tables from different databases.

it is very slow and creating lot of performance issues.

what i though of is replicating user table in other microservice by a job which makes sure it is up to date and using only one api like

GET /user/activities?location=colombia.

but replicating a table(user) is breaking the micro-service architecture main fundamentals

is there any other way to do it or support this type of filter criteria which join's tables from different micro-services.

Upvotes: 2

Views: 801

Answers (2)

ahmed metwaly
ahmed metwaly

Reputation: 41

you can avoid slowness by multiple things . for step number 2 "2)then for individual user Get /user/activity/{userId}"

  • instead of sending user by user you can send multiple users in one call .
  • you can have parallel threads to retrieve multiple users chunks on same time.
  • if you have a web interface you can use pagination which really help .

Upvotes: 0

berrytchaks
berrytchaks

Reputation: 849

You might be interested in using Command Query Responsibility Segregation

See this implementing queries that need to retrieve data owned by multiple services.

You can draw much inspirations from this example (Customers and Orders example of http://eventuate.io/).

Upvotes: 5

Related Questions