<#637 Implement Node Caching to Improve Performanc...
# osctrl
g
#637 Implement Node Caching to Improve Performance with Large Deployments Issue created by zhuoyuan-liu We've already successfully implemented environment caching with
EnvCache
to reduce database load, but for deployments with 20,000+ nodes, we need to extend this caching pattern to node operations. The
QueryReadHandler
and other node-related handlers are experiencing performance issues due to frequent database queries for node data. Currently, every request that needs node data calls
h.Nodes.GetByKey()
directly, which results in: 1. A database query for every incoming node request 2. No reuse of frequently accessed node data 3. High database load with thousands of concurrent node connections This screenshot shows the total number of calls for each database query over the past three hours. As you can see, after applying the in-memory cache, the
SELECT tls_env
query stopped increasing. Previously, it was the most frequently executed query. [Image](https://private-user-images.githubusercontent.com/117184318/429992021-bc586192-9209-4b56-999e-82cf4fcb92af.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDM2OTQ0NjksIm5iZiI6MTc0MzY5NDE2OSwicGF0aCI6Ii8xMTcxODQzMTgvNDI5OTkyMDIxLWJjNTg2MTkyLTkyMDktNGI1Ni05OTllLTgyY2Y0ZmNiOTJhZi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwNDAzJTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDQwM1QxNTI5MjlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0xMTAzZWJjZmMzOGIyNTkzY2Y5MThjNDQ4YmY5MzVkM2VhZmZjZGE2ZjZhZGIyNGM2NzUzN2YzZmUwNjFkOTAzJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.4uKXPo79yRNgkWW0S58jQzz24xK-qWkegzjRZJRryP4) You can find the implementation at: #636 We would like to implement the same thing for the node key. jmpsec/osctrl