Alternative for clients storage #3339
Replies: 2 comments 11 replies
-
If you want advanced client management, I suggest to look into Marzban. I still agree that xray could have a different API for it (I quite like the one that Hysteria2 has, where it calls an HTTP endpoint to help with auth) |
Beta Was this translation helpful? Give feedback.
-
I'm interested in this too, though for different reasons. Our config is quite large as we allow each user to have custom inbounds, outbounds and routing. Servers are starting to run out of memory. The on-disk JSON is perhaps 20MB per process, but Xray-core blows this up into 2GB RAM usage easily. Run multiple processes and your RAM is full. It feels wasteful. A given server at a given time serves only a handful of users. But it keeps thousands of other users in its memory unnecessarily. Ideally it loads and caches the config for a particular user when this user actually connects. The drops the cached config if the user hasn't connected for a certain amount of time. I'm not sure if it really needs Redis or a database. As noted, the actual JSON is quite small and can be processed very quickly. It just needs to gain the ability to re-read it and cherry-pick the users/routing/outbounds it actually needs. |
Beta Was this translation helpful? Give feedback.
-
Disclaimer: i don't speak Chinese so i may not know about similar discussion in Chinese
As far as i know Xray-core has only 2 ways to store clients for VLESS.
There is workaround if we combine 2 strategies (API call + file change) but it does not resolve 2 last problems with file storage.
My proposal is to allow alternative storages for clients. The ideal scenario is if i can store clients in Redis (or other DB) or integrate with third-party REST API and also have some in-memory cache for performance.
Inbound config can look like this:
To implement this Validator must become an interface, custom storages must be written and we need to change config scheme. It is a perfect place to use plugins to let people write their own storages, but i find it too hard to implement, while things i described i can make myself.
My questions:
Beta Was this translation helpful? Give feedback.
All reactions