Comments (19)
When i had the need to have more than one cache for the application Roberto suggested to switch to redis, I did and never looked back :) The internal uswgi cache really lacks flexiblity, e.g when it is full you have to implement your own cleanup policy, was not fun for me. Said that it would be a useful feature.
from uwsgi.
what about the suggested "stores" API, is that similar/related? could that be leveraged to replace the uwsgi cache altogether?
basically we have the need for some (inter-node) shared and.or cached state by arbitrary components, and must then be able to relay the proper "silo"/store/
from uwsgi.
The idea is having the storage subsystem over the cache subsystem, to implement namespaces and recycle policy (read: what to do when the storage is full). So in the future you should be able to create different "virtual disks" mapped the the cache shared memory. Sadly i do not know when it will be ready for commit
from uwsgi.
ok then we'll just let this unfold a little more then :)
thanks for responses.
from uwsgi.
Ok, it seems having different caches with different settings (block-size, item-size, hashing algorithm...) is something really needed (for example ssl sessions caching works better with a tuning completely different from a web cache). I reopen that.
from uwsgi.
Ok, committed the first round of multiple caches. A new option has been added --cache2 allowing the configuration of "new generation caches"
--cache2 name=X,max_items=n[,keysize=n,blocks=n,blocksize=n,hashsize=n,hash=S,store=S]
the new thing is that you can now specify the maximum keysize, hashsize and the hash algorithm (currently supported djb33x and murmur2, others will be added). This allows for ultra-optimized stores based on the content.
The new system can be already utilized with SSL sessions and fast/http/raw-router host->backend mappings.
Another addition will be the usage of blocks bitmap (if requested) to allows object to be stored on multiple blocks (to avoid wasting space).
Issues:
The cache sync system (via udp) is currently broken
The optimized cache server is broken
The cache sweepers (the threads aimed at clearing dead items) are broken
The cache remote plugin works only with the default (old style) cache
The cache api for languages still does not support named caches (maybe it will be required to add more api functions to maintain backward compatibility)
from uwsgi.
With every uWSGI release I tend to think "this is great, it can't get any better". And then next release comes out and somehow it does ;)
Is there any long term road map? Maybe it's time to start adding milestones to github issues?
from uwsgi.
there is no roadmap as most of the things pop-up from customers requests or funny/strange ideas proposed by someone :)
from uwsgi.
It looks that way, but for clarity we could have few milestones defined ("1.5", "1.6", "when I'm bored") and tag requests as they are reported.
from uwsgi.
ok, added 1.5 and 1.6.
from uwsgi.
awesome! it may be already doing something like this, but if not, i would suggest prefixing the names of any [implicit] internal stores with some char or string, so people can reliably avoid clobbering them...
...eg. :tls-sessions
or __tls-sessions
i think this should primarily be done for stuff that uses the cache implicitly; if you must specify the cache name it's not as important. initially i was going to suggest that implicitly used caches be isolated somehow, but there are probably interesting reasons to manually pop/push stuff to internal stores (prefill/inspect/etc).
from uwsgi.
Update:
cache sweepers are working again, a thread will be spawned for each cache (to avoid waiting on big caches iterations)
The stats server now exports lot of infos about caching, someone interested in developing a uwsgicachetop ?
from uwsgi.
Is there any API for creating named cache from plugins? If not (and I don't see any) would it be possible to add this? I could play a bit more with clustered crons and maybe improve it to the point where someone is willing to use it.
from uwsgi.
from the init hook (NOT BEFORE !!!)
struct uwsgi_cache *mycache = uwsgi_cache_create("name=pippo2,max_items=100");
from uwsgi.
It appears that it works a little bit different:
uwsgi_cache_create("name=clustered_crons,max_items=100,blocksize=4096");
struct uwsgi_cache *mycache = uwsgi_cache_by_name("clustered_crons");
from uwsgi.
fixed it, if uwsgi-cache_create returns the uwsgi_cache struct you do not need to parse the args to get the name of the cache (allowing the user to customize it)
from uwsgi.
Another update (really few parts missing). The cache udp update system (the one needed for ssl sessions) has been ported to the new api. The syntax for --cache2 is currrently that:
if (uwsgi_kvlist_parse(arg, strlen(arg), ',', '=',
"name", &c_name,
"max_items", &c_max_items,
"maxitems", &c_max_items,
"items", &c_max_items,
"blocksize", &c_blocksize,
"blocks", &c_blocks,
"hash", &c_hash,
"hashsize", &c_hashsize,
"hash_size", &c_hashsize,
"keysize", &c_keysize,
"key_size", &c_keysize,
"store", &c_store,
"node", &c_nodes,
"nodes", &c_nodes,
"sync", &c_sync,
"udp", &c_udp_servers,
"udp_servers", &c_udp_servers,
"udp_server", &c_udp_servers,
"udpservers", &c_udp_servers,
"udpserver", &c_udp_servers,
NULL)) {
uwsgi_log("unable to parse cache definition\n");
exit(1);
}
a bunch of options could be added before 1.9.
Issues:
cache initial sync is still pretty-broken (working on that right now, see below)
The optimized threaded cache server is broken
The cache plugin still need porting to the new api (this requires cache plugin fix)
The languages cache api still need to be defined. Currently my idea is adding cache_get2|set2|update2|del2 taking as the first argument the name of the cache.
Store to disk still need some love (hope to fix it later today)
from uwsgi.
Fast update: the cache store system has been ported to the new api.
from uwsgi.
i close that as the whole cache api has been rewritten
from uwsgi.
Related Issues (20)
- Unable to install on Ubuntu 22.04 with Python 3.10 HOT 4
- Issue with pgAdmin4 web HOT 1
- uWSGI 2.0.22 fails to build against Python 3.12 HOT 6
- Do cron jobs respect ranges? HOT 2
- I want to hash and distribute the sid parameter gold in the client post request to the worker process consistently. How to configure the parameters? Please provide the following example
- uwsgi spawning too many thread HOT 2
- Inline comments in .ini configuration HOT 1
- Uwsgi dont response for requests HOT 1
- Uwsgi max_queue metric returns invalid value for IPv6 sockets HOT 2
- Python 3.12 has fatal error HOT 34
- harakiri triggered instantly in 2.0.22+ when post-buffering is set to 1 and harakiri > 60 HOT 2
- Worker stopped abruptly in between while processing the python request HOT 2
- Compilation failure due to unused variables HOT 4
- Mechanism to insert a hook pre forking or before a worker process is spawned
- uwsgi_corerouter_loop malloc more than 8G memory HOT 1
- queue / max_queue metrics returns invalid values for UNIX domain sockets HOT 1
- New releases don't include commits from years ago
- How do I silence the startup messages outputed by UWSGI? HOT 1
- Troubleshooting uWSGI Log Rotation Configuration in a Django Container Environment
- Attaching debugger to process
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from uwsgi.