3 ms·
If you use the magic of hashing you can lookup where user's pages are without the dependency on the database.
by siliconc0w 11y ago
If you use the magic of hashing you can lookup where user's pages are without the dependency on the database.
- deleted 11y ago[deleted]
- brador 11y agoHow would you use hashing for that?
- slig 11y agoUsing "Consistent Hash" [1], for instance. > Consistent hashing is a very simple solution to a common problem: how can you find a server in a distributed system to store or retrieve a value identified by a key, while at the same time being able to cope with server failures and network partitions? [2] [1]: http://en.wikipedia.org/wiki/Consistent_hashing http://en.wikipedia.org/wiki/Consistent_hashing [2]: http://www.martinbroadhurst.com/Consistent-Hash-Ring.html http://www.martinbroadhurst.com/Consistent-Hash-Ring.html
- TheLoneWolfling 11y agoHuh. I wonder if a consistent hash + remalloc would be faster than a standard hashmap for frequent insertions/deletions.
- charliesome 11y agoUnfortunately this isn't an option for us. We need to be able to move sites between fileservers periodically to keep disk usage and load balanced. Adding new fileservers when using a hash modulus based routing scheme is also quite complex as it would require copying quite a lot of site data between fileservers. Pages also supports custom domains for both user sites and per-project sites, so we'd still need a way to resolve domains to users.
- emj 11y agoThink about moving around hash buckets, not sites nor files. You can decide what you want to keep in memory data or metadata. Now you need both sites+file metadata, neither of those need to be stored when serving static files you yourself rename and place everytime they are published.