Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

Allow setting MaxMind reader mode from environment #1397

Closed
jwhitlock opened this issue Oct 27, 2020 · 0 comments
Closed

Allow setting MaxMind reader mode from environment #1397

jwhitlock opened this issue Oct 27, 2020 · 0 comments

Comments

@jwhitlock
Copy link
Member

The Maxmind Reader has several ways to read the database:

  • MODE_MMAP_EXT - use the C extension with memory map.
  • MODE_MMAP - read from memory map. Pure Python.
  • MODE_FILE - read database as standard file. Pure Python.
  • MODE_MEMORY - load database into memory. Pure Python.
  • MODE_FD - load database into memory from a file descriptor. Pure Python.
  • MODE_AUTO - try MODE_MMAP_EXT, MODE_MMAP, MODE_FILE in that order. Default.

We're implicitly using the default of MODE_AUTO. We assume this resolves as MODE_MMAP_EXT, but the selected mode is not available (see maxmind/MaxMind-DB-Reader-python#13)

We may want to explicitly use MODE_MMAP_EXT and fail if the C extension is not available. We may also want to experiment with different modes, to see if there are improvements in performance for production for metric such as web worker startup time, average query speed, and memory usage.

This issue covers adding an environment override, which could be tested in the development environment. The production changes should be a separate issue.

Originally filed as bug 1666037 on 2020-09-18

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants