You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Most often use case in PHP is to detect a country/city of current request's IP address. In common fpm/fastcgi environment database file is re-opened and re-read on each and every request when MaxMind\Db\Reader instance is created. The idea is to keep database file opened as long as php fpm/fastcgi master process is alive. Simple tests show performance gain at least by an order of magnitude.
As as side note, database should be reloaded whenever its file size or timestamp has changed.
The text was updated successfully, but these errors were encountered:
I am not sure this would be possible with the pure PHP reader. It might make sense for the extension, but we would need to figure out a reasonable way to provide a mostly compatible API.
Yes, I was talking about the extension of course. Speaking of API — that could be an optional boolean parameter to MaxMind\Db\Reader constructor. If set to true, an attempt would be made to reuse an existing file handle. Obviously, pure PHP reader would just ignore that parameter, and this behaviour is consistent to the extension's behaviour when no previously open file handles were found (i.e. "cold start").
Most often use case in PHP is to detect a country/city of current request's IP address. In common fpm/fastcgi environment database file is re-opened and re-read on each and every request when
MaxMind\Db\Reader
instance is created. The idea is to keep database file opened as long as php fpm/fastcgi master process is alive. Simple tests show performance gain at least by an order of magnitude.As as side note, database should be reloaded whenever its file size or timestamp has changed.
The text was updated successfully, but these errors were encountered: