You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue: Encoding large data for networking causes thread locking
Scenario: I network a large table - express.send locks main thread for 0.3s~ (which is unacceptable for loading inventories on player join for example).
Proposed resolution:
I first solved this by chunking my table and then sending chunked gm_express (boo!) messages, which is a bit janky. If any of the messages fail, then the data can't be reconstructed. My current working resolution involved gutting a lot of the core addon removing encode/decode and sending a giant serialised encoded string (serialising/encoding was done in chunks over a timer to prevent threadlocking) sending my string via express.send takes 0.004s which is a massive improvement over the original 0.3s. I have not been able to implement the hashing functionality, but I don't utilise it anyway
Itd be useful if we could specify how the data is encoded or decoded so we can avoid these thread locks through various means - networking data fast is great, but if we're locking up the server thread to encode the data a lot of the use cases are moot.
My idea is essentially..
express.send("msg", data, function(enc)
-- encode data
return specialencode(enc)
end)
Of course, we would need to specify on the receiver how the data is decoded.
The text was updated successfully, but these errors were encountered:
Issue: Encoding large data for networking causes thread locking
Scenario: I network a large table - express.send locks main thread for 0.3s~ (which is unacceptable for loading inventories on player join for example).
Proposed resolution:
I first solved this by chunking my table and then sending chunked gm_express (boo!) messages, which is a bit janky. If any of the messages fail, then the data can't be reconstructed. My current working resolution involved gutting a lot of the core addon removing encode/decode and sending a giant serialised encoded string (serialising/encoding was done in chunks over a timer to prevent threadlocking) sending my string via express.send takes 0.004s which is a massive improvement over the original 0.3s. I have not been able to implement the hashing functionality, but I don't utilise it anyway
Itd be useful if we could specify how the data is encoded or decoded so we can avoid these thread locks through various means - networking data fast is great, but if we're locking up the server thread to encode the data a lot of the use cases are moot.
My idea is essentially..
express.send("msg", data, function(enc)
-- encode data
return specialencode(enc)
end)
Of course, we would need to specify on the receiver how the data is decoded.
The text was updated successfully, but these errors were encountered: