Quote:
Originally Posted by NullPointer
I wasn't thinking of IPv6 addresses. Converting an IPv4 address to an integer is fairly simple. Each section is an 8-bit integer (0-255) so all you have to do is drop the separator and append the bits to get a 32 bit integer. It has to be unsigned to store it as an INT in mysql otherwise you'll get an overflow. If you're using PHP see:
http://us2.php.net/manual/en/function.ip2long.php
http://us2.php.net/manual/en/function.long2ip.php
You can do something similar with ipv6 but you would have to use a bigint and converting it would be a bit more complicated. It would still reduce the cost of comparisons and decrease the amount of storage required.
|
Thanks mate,
Ill certainly look into it.
May write an optimised version of the files that use it and if the server starts getting slow for day to day usage, I could change to that.
Currently everything else is very speedy ( think ive optimised the php and DB to a point that it works well )
It was just this **** delete that would lock the whole system when deleting the rows from that table.
Oddly while it should only lock that one table, It seems to hang query's on other tables.
But this shouldnt ( touch wood ) be a problem anymore since these indexes have been fixed.
My optimisation path:
- Sort php files out to be leaner.
- Sort queries out to be less querys ( some pages used like 15 querys , now its down to 1 or two )
- Sort the indexes
- Move the DB to a separate server.
- Add more frontend servers to the system.
- Move the DB to another server and change the DB to run from memory / upgrade current server with like 16gig of ram.
- Cluster the databases.
- Cry
Last edited by lynxus; 01-01-2011 at 04:29 PM..
|