Open hackallcode opened 10 months ago
Original issue screenshots:
Initial thoughts based on ./doc/playground.lua
: it's not clear whether crud or not is the reason.
crud.get
.crud.get
.space:get
call.See examples below. Beware that playground instance is a router and a storage at the same time, it also may affect the experiment.
tarantool> crud.get('customers', 1); print(box.stat()['SELECT']['total'])
257
---
...
tarantool> crud.get('customers', 1); print(box.stat()['SELECT']['total'])
259
---
...
tarantool> crud.get('customers', 1); print(box.stat()['SELECT']['total'])
260
---
...
tarantool> crud.get('customers', 1); print(box.stat()['SELECT']['total'])
261
---
...
tarantool> crud.get('customers', 1); print(box.stat()['SELECT']['total'])
262
---
...
tarantool> crud.get('customers', 1); print(box.stat()['SELECT']['total'])
263
---
...
tarantool> crud.get('customers', 1); print(box.stat()['SELECT']['total'])
264
---
...
tarantool> crud.get('customers', 1); print(box.stat()['SELECT']['total'])
265
---
...
tarantool> crud.get('customers', 1); print(box.stat()['SELECT']['total'])
266
---
...
tarantool> print(box.stat()['SELECT']['total'])
268
---
...
If CRUD not configured.
diff --git a/doc/playground.lua b/doc/playground.lua
index d4e547f..e42720b 100755
--- a/doc/playground.lua
+++ b/doc/playground.lua
@@ -146,8 +146,8 @@ box.once('developers', function()
end)
-- Initialize crud.
-crud.init_storage()
-crud.init_router()
+-- crud.init_storage()
+-- crud.init_router()
-- Start a console.
console.start()
tarantool> vshard.router.callrw(1, 'box.space.customers:get', {1}); print(box.stat()['SELECT']['total'])
185
---
...
tarantool> vshard.router.callrw(1, 'box.space.customers:get', {1}); print(box.stat()['SELECT']['total'])
188
---
...
tarantool> vshard.router.callrw(1, 'box.space.customers:get', {1}); print(box.stat()['SELECT']['total'])
190
---
...
tarantool> vshard.router.callrw(1, 'box.space.customers:get', {1}); print(box.stat()['SELECT']['total'])
192
---
...
tarantool> vshard.router.callrw(1, 'box.space.customers:get', {1}); print(box.stat()['SELECT']['total'])
194
---
...
I noticed that for each crud replace in the metrics on the master, 1 select and 1 replace are added. It seems that this is the same select as in the get request.
I use the same query:
crud.MakeReplaceObjectRequest("users").Object(crud.MapObject{
"token": uuid.NewString(),
"user_id": uuid.NewString(),
})
I call crud.get via go-tarantool using the primary key in this way:
client.Do(crud.MakeGetRequest("users").Key([]any{reqUser.Token}), pool.ANY)
As a result, I look at the
tnt_stats_op_total
metric and see that one call and two selects are made on storage, which is strange. It seems that there should be one select, since this is a point query based on the primary key