In page 402, we can scale up the app using the blow command:
docker-compose up --scale multiplication=2 --scale gamification=2
This is my result of calling leaderboard api ( http :8000/leaders) before and after scaling up the project:
Before:
Mahdis-MacBook-Pro:LearningMicroServices-v2-update-2.4.0-master mahdishabani$ http :8000/leaders
HTTP/1.1 200 OK
Content-Type: application/json
Date: Sun, 04 Apr 2021 08:35:48 GMT
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
transfer-encoding: chunked
[
{
"badges": [
"First time"
],
"totalScore": 10,
"userId": 1
}
]
And After scaling up , each time I got different response:
First call:
Mahdis-MacBook-Pro:LearningMicroServices-v2-update-2.4.0-master mahdishabani$ http :8000/leaders
HTTP/1.1 200 OK
Content-Type: application/json
Date: Sun, 04 Apr 2021 09:09:47 GMT
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
transfer-encoding: chunked
[]
Second Call:
Mahdis-MacBook-Pro:LearningMicroServices-v2-update-2.4.0-master mahdishabani$ http :8000/leaders
HTTP/1.1 200 OK
Content-Type: application/json
Date: Sun, 04 Apr 2021 09:14:29 GMT
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
transfer-encoding: chunked
[
{
"badges": [
"First time"
],
"totalScore": 10,
"userId": 1
}
]
Third call:
Mahdis-MacBook-Pro:LearningMicroServices-v2-update-2.4.0-master mahdishabani$ http :8000/leaders
HTTP/1.1 200 OK
Content-Type: application/json
Date: Sun, 04 Apr 2021 09:14:29 GMT
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
transfer-encoding: chunked
[
{
"badges": [
"First time"
],
"totalScore": 10,
"userId": 1
}
]



You can see each time I refresh the page, I got a different result.
This problem just happens when I scaled up the project. Before scaling up, everything was stable and consistent.
In page 402, we can scale up the app using the blow command:
docker-compose up --scale multiplication=2 --scale gamification=2
This is my result of calling leaderboard api ( http :8000/leaders) before and after scaling up the project:
Before:
Mahdis-MacBook-Pro:LearningMicroServices-v2-update-2.4.0-master mahdishabani$ http :8000/leaders
HTTP/1.1 200 OK
Content-Type: application/json
Date: Sun, 04 Apr 2021 08:35:48 GMT
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
transfer-encoding: chunked
[
{
"badges": [
"First time"
],
"totalScore": 10,
"userId": 1
}
]
And After scaling up , each time I got different response:
First call:
Mahdis-MacBook-Pro:LearningMicroServices-v2-update-2.4.0-master mahdishabani$ http :8000/leaders
HTTP/1.1 200 OK
Content-Type: application/json
Date: Sun, 04 Apr 2021 09:09:47 GMT
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
transfer-encoding: chunked
[]
Second Call:
Mahdis-MacBook-Pro:LearningMicroServices-v2-update-2.4.0-master mahdishabani$ http :8000/leaders
HTTP/1.1 200 OK
Content-Type: application/json
Date: Sun, 04 Apr 2021 09:14:29 GMT
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
transfer-encoding: chunked
[
{
"badges": [
"First time"
],
"totalScore": 10,
"userId": 1
}
]
Third call:
Mahdis-MacBook-Pro:LearningMicroServices-v2-update-2.4.0-master mahdishabani$ http :8000/leaders
HTTP/1.1 200 OK
Content-Type: application/json
Date: Sun, 04 Apr 2021 09:14:29 GMT
Vary: Origin
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers
transfer-encoding: chunked
[
{
"badges": [
"First time"
],
"totalScore": 10,
"userId": 1
}
]
You can see each time I refresh the page, I got a different result.
This problem just happens when I scaled up the project. Before scaling up, everything was stable and consistent.