Replies: 6 comments 6 replies
-
Update https://gist.github.com/dalf/b3728182ef69f855c9103db6e31f38ed With indexes, SQLite is actually only 10 to 20 time slower than a memory access, and with a small cache is can be similar. Of course, it does not solve the statistics issue (shared the stats between the workers). ping @return42 [EDIT] Anyway, if the memory is issue, the translation loads about 60MB in RAM (checked |
Beta Was this translation helpful? Give feedback.
-
I think access to individual records is not quite as critical since we need access to those records relatively infrequently (we will rarely do a SQL-SELECT on these tables). I would be more concerned with a SQL solution that initializing the SQL databases (connect and first query) takes more time than loading a python module with a big dictionary in. Do you have any experience with this? |
Beta Was this translation helpful? Give feedback.
-
Actually, The line that allocates memory: Line 157 in 11c0651 The purpose of this code is to do that:
So, one idea is to store these values in |
Beta Was this translation helpful? Give feedback.
-
wow thats much 👍 .. may we have a chance to remove that monkey patching of flask_babel Line 134 in 11c0651 Form the .. Lines 37 to 41 in 11c0651 we can at least remove
|
Beta Was this translation helpful? Give feedback.
-
This is unrelated to my comment. I can't say if this is possible. I've just focused on |
Beta Was this translation helpful? Give feedback.
-
The "issue" with sqlite is readability: it requires an external program to read the content compare to json. We can keep an SQL dump in the repository: it won't be use, but it makes the PRs easy to compare. SQLite supports multiple tables per database, in the case of SearXNG it can make sense to create one database file per data type, so we keep the update workflow. |
Beta Was this translation helpful? Give feedback.
-
For reference :
sqlite is available in all Python standard version, multiple workers can access the same read-only database. It would decrease the memory footprint by ~ 10 MB per worker according to
tracemalloc
.The drawback is the access time : about 300 nanosec instead of few nanosec. A small cache can help., and it would not be a problem for
engine_descriptions.json
for example.external_bangs.json
might be different since there are a lot of access and they need to be fast.Beta Was this translation helpful? Give feedback.
All reactions