Live data from Hacker News

I made a simple geolocation service

maxkostinevich.com

111–120 of 187 posts

Re: I made a simple geolocation service

#111

I applaud your efforts but it's disingenuous to title this how you "made a geolocation service" when you are just reading a field in someone else's geolocation service.

Almost all geolocation services read a field from MaxMind's db file.

It's a nice solution. Why log into your alt account to crap on it?

Re: I made a simple geolocation service

#112
post #89
post #22

Google App Engine had this quite a while ago (almost a decade, I think)and a very generous free tier. Also has approx lat-long, city, state and country. https://blip.runway7.net https://github.com/runway7/blip I lost track of the consumer apps I've used this on and still haven't received a $1+ bill.

Is there a good lat/lon to timezone database that lets you leverage this into a presumptive timezone offset from UTC and thus local time?

Can’t you just ask the client which timezone it’s in? Every browser knows, and it will be a more accurate answer: the user might be on a foreign VPN or temporarily in another TZ, but not working on that timezone.

Re: I made a simple geolocation service

#113
post #63
post #14

I (like many others it seems!) have also built a geolocation service however mine is built on top of MaxMind's DBs that are mentioned in the post. Its on a few boxes running OpenResty and now handles 130m+ requests/day. Was really fun to build! https://github.com/jloh/geojs https://www.geojs.io/open/

It's forbidden by MaxMind ToS, these dudes changed the rules and forces you to abide to the new conditions when you download an update. It's very borderline from them (at least ethically)

At the bottom of the page it credits the MaxMind GeoLite database. The GeoLite2 database is licensed as CC BY-SA 4.0. It's the GeoIP2 database that has stricter licensing.

https://dev.maxmind.com/geoip/geoip2/geolite2/

Re: I made a simple geolocation service

#114
post #98

I applaud your efforts but it's disingenuous to title this how you "made a geolocation service" when you are just reading a field in someone else's geolocation service.

Indeed. Using another service and being a wrapper around it is not all that impressive. He is also using workers which makes his solution expensive. I run ifconfig.io which now gets just over a billion hits a day. It is basically an echo service, and it just parrots back what cloudflare tells it. But since I run it on linode, it costs me a whopping $40 dollars a month for 35 billion returns a month. Using workers wou…

He could have used the CF cache API in the worker, which would drop the cost quite a lot.

Re: I made a simple geolocation service

#115
post #64

Earlier quoted context omitted.

GP and you aren't using the same definition of cloud. By cloud, they mean infrastuctures like AWS/GCP/Azure, not simple VM hosting (called VPS outside "clouds", and compute nodes in "clouds")

What's the definition of "cloud" then which excludes VPS from the umbrella of services offered in cloud? Not really sure how a VPS is any different from a Google Compute Engine

I think the main difference is the pricing structure. Usually "cloud" refers to the auto-scaling servers with the pay-as-you go pricing, while VPSs are usually manually instantiated and have a fixed monthly cost. Also, sometimes with VPSs you get more control over the server's settings than with "cloud" services.

So "cloud" is like renting a dynamically changing number of VPSs each month and which are usually more costly if your consumption is not spiky (eg. when a cheap VPS rented 24/7 is enough).

Re: I made a simple geolocation service

#116
post #48
post #34

Also please see https://github.com/analogic/ipgeo daily actualized ip/country database with open license (shameless ad)

That would be a lot more appealing if it explained where the data is sourced from, included the update scripts, and how it is licensed - the only issue asking that question was closed without a word.

The issue was closed with a commit adding the MIT license to the repo.

Re: I made a simple geolocation service

#117
post #114
post #98

Earlier quoted context omitted.

Indeed. Using another service and being a wrapper around it is not all that impressive. He is also using workers which makes his solution expensive. I run ifconfig.io which now gets just over a billion hits a day. It is basically an echo service, and it just parrots back what cloudflare tells it. But since I run it on linode, it costs me a whopping $40 dollars a month for 35 billion returns a month. Using workers wou…

He could have used the CF cache API in the worker, which would drop the cost quite a lot.

How would it reduce the cost? They are only return data from inside the header of the request they received and doing (an unnecessary) lookup to turn the country code into a country name.

What would you cache it cheaper?

No matter what his worker needs the smallest time/memory slot there is. You cannot make it cheaper while still using workers.

Re: I made a simple geolocation service

#118
post #101

Regarding latency of AWS Lambda: > on average the response took somewhere between from 200ms to 500ms I'm getting latency of 66ms to 126ms with some simple Java code running on AWS Lambda using provisioned concurrency. I find the latency is just fine for most use cases.

"using provisioned concurrency" What's the point of using Lambda if you have to provision capacity for it? You pay a premium on the compute because it's able to scale down to zero (so in theory, it works out cheaper anyway), but in reality it only works well when you do everything in your power to have it not scale down to zero.

For my use case, it is still much cheaper than having a dedicated VM.

Re: I made a simple geolocation service

#119
post #83

Earlier quoted context omitted.

Installing updates and stuff is easy to automate.

And sometimes automatic updates break and then the site may be down until you find the problem which may require much reading and therefore a longer time if you don't deal with sysadmin stuff often. With PaaS it's someone else's job who does this every day.

If you stick to LTS releases and stay away from Oracle/Java then you are highly likely to never have OS updates break the application.

Re: I made a simple geolocation service

#120
Full marks to Cloudflare for engineering a radically effective and simple alternative to AWS Lambda (+API Gateway): It is simply a fantastic Serverless offering for low-latency network-bound workloads. For paying customers, they even thrown in freemium access to their globally distributed KV store and a forever-free Zonal Cache to sweeten the already good enough deal. That said, good luck with their Support team in case you discover undocumented limits (in production) like these [0].

I got sent a (frustratingly incorrect) bot reply to a ticket and a reminder that Enterprise / Business / Pro customers are priority (in that order) even though I pay for Workers. It has been an uphill battle to get someone to take a look at the ticket so far. Thankfully, we haven't gone to production yet, but as a consequence, now need to plan to add mitigation in scenarios where Workers blacks-out our traffic (but Support can't be of immediate help because "free customer").

[0] https://community.cloudflare.com/t/workers-and-sub-requests/...

Post reply on HN