4 ms·
Can you make a geolocation service from static files? 2^32 IP4 addresses with 2 floats per address would take only 34 gigabytes of storage. Put 256 addresses in
by layoutIfNeeded 6y ago
Can you make a geolocation service from static files? 2^32 IP4 addresses with 2 floats per address would take only 34 gigabytes of storage. Put 256 addresses in a given file, and turn the other three octets into folders. E.g. https://example.com/192/168/0.txt https://example.com/192/168/0.txt would contain the location for addresses 192.168.0.0-192.168.0.255.
Would this be cheaper than running these services?
- hansitomani 6y agoYou could also generate all those files, put that into a GCS Bucket and put an API Gateway in front. easier would be and thats just a thought: You could build a go/c++/java app which contains that database pre compressed in some arbitrary better format than just 2 floats, get it down from your original 34gig and just keep it in memory. Like if you know that 99% of all ips in a certain range are from US, then only store the 1% as a list.
- layoutIfNeeded 6y agoSure, but my point was that it can be done with zero compute cost. There's nothing cheaper than serving static files from cloud storage.
- hansitomani 6y agoThat is just not true. GCS for example and its the same with S3, costs space, egress and requests themself. Data Storage 50 GB Standard Storage * $0.026 per GB $1.30 Network 10 GB egress * $0.12 per GB $1.20 Operations 10,000 Class A operations * $0.05 per 10,000 operations $0.05 Operations 50,000 Class B operations * $0.004 per 10,000 operations $0.02
- zrail 6y agoMaxMind sells their databases as files as well as APIs. GeoLite is free to use but not as accurate as their paid products.