-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple webserver workers has different db state for FlatFile #32
Comments
Hey @rewiaca , thanks for trying ! I think the problem is that the FlatFile storage engine doesn't have any file lock so it's not multiple processes safe. |
Also, I don't think this line could actually set the config
|
Nice, LMDB work great! Thanks, just installed lmdb through pip and that's all. As I understand, each worker will not hold all database in memory but it will load up from file every request, what is the difference?
How to I set config properly then? |
Glad that LMDB storage engine helps !
Well, the FlatFile storage engine is a really dead simple one storage engine which will re-write the whole file when the changed document count has reached
Ah, I thought the README did provide those info, but it is not clear ! (README only says what config entry they have but does't say how to set them) The config should be set by the For Flatfile would be like this : from montydb import set_storage, MontyClient
set_storage("/db/repo", storage="flatfile", cache_modified=1)
client = MontyClient("/db/repo") For LMDB: from montydb import set_storage, MontyClient
set_storage("/db/repo", storage="lightning", map_size=10485760) # Maximum size database may grow to.
client = MontyClient("/db/repo") And you should found a file named |
First of all, great lib for small prods and dev without installing and handling mongod or old-fashioned sqlite3!
Having a problem using supervisor with multiple workers, so basically running several instances of the same python script that connects to database, writing and reading it.
The problem is that every worker has different version of database. My config:
With
cache_modified = 0
also the same problem.I think that montydb stores database is memory and consider FlatFile as a cache, so turning
cache_modified
to 1 would help, but not. Maybe the problem has another logic?The text was updated successfully, but these errors were encountered: