Re: the real problem with the ip-to-country DB / phpweb
| From: | Wez Furlong | Date: | Sun, 25 May 2003 14:19:13 +0000 |
| Subject: | Re: the real problem with the ip-to-country DB / phpweb | ||
| References: | 1 2 3 4 5 6 | Groups: | php.mirrors |
| Request: | Send a blank email to php-mirrors+get-18078@lists.php.net to get a copy of this message | ||
Due to my "love affair" with sqlite, I did consider this, however, Ilia
suggested that some scheme using shared memory will be the fastest.
If we store the database in the binary equivalent to the format that you
suggested, we can make some very fast lookups by incurring the overhead
of a single PHP function call, rather than a whole bunch of them and
their related syscalls (fseek, fread etc. etc.).
Also, implementing it in C gives us the option of perhaps implementing
some kind of mod_mirror for Apache, so that we can perform intelligent
load balancing before we even hit the PHP engine.
--Wez.
On Sun, 25 May 2003, Gabor Hojtsy wrote:
> BTW there is no need to implement a custom PHP extension for this. You
> can put the data into a three column DB (range start, range end,
> country). The first 10 bytes in every record are the range starts padded
> with zeros from the left in our file. Similar ar the range ends, and 3
> bytes are for the country codes. We can employ sqlite maybe for this
> search. PHP.net can put that DB into a table after rsync updated the
> data file. And then search can go on in that DB. That would also enable
> any sqlite having mirrors to have better lookup speeds :)
>
> Goba
>
>
>