Write
Read
Command Query Responsibility Segregation
Base on a ~19Ko article and 5 Joins
| With PgSQL | With ES
--------------+-------------+---------------
1000 articles | 22 secondes | 0,675 seconde
| VM | Docker
-------------+---------+---------
Boot time | ~1 min | 0.3 sec
Memory usage | ~256 Mo | 1 Mo
Disk usage | ~1 Go | 100 Ko
needs
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlcyI6WyJyZWFkIiwid3JpdGUiXX0.sScm9scsYDYNASEmwkwCCNm3F5i9Qq6BNdeF2mN-rL0
{
"alg": "HS256",
"typ": "JWT"
}
{
"roles": ["read", "write"]
}
HMACSHA256( base64UrlEncode(header) + "." + base64UrlEncode(payload), "secret" )
managed at service level
avantages
always up to date
benchmark based on an standard API request
| Without cache | With cache
--------------+---------------+------------
100 requests | 0m17.162s | 0m0.252s
1000 requests | 2m45.451s | 0m1.160s
{
user(id: 3500401) {
id,
name,
isViewerFriend,
profilePicture(size: 50) {
uri,
width,
height
}
}
}
Request
{
"user" : {
"id": 3500401,
"name": "Jing Chen",
"isViewerFriend": true,
"profilePicture": {
"uri": "http://someurl.cdn/pic.jpg",
"width": 50,
"height": 50
}
}
}
Response