SDFIdk / gsearch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Status code 504 (Gateway Timeout) on husnummer resource

sweco-dkgemr opened this issue · comments

We tried making the below call to the API using the husnummer resource:
https://api.dataforsyningen.dk/rest/gsearch/v1.0/husnummer?q=1&limit=15&token=XXXXXXXXXXX
It results in a status code 504 (Gateway Timeout)

This is probably due to the fact that there is a hugh amount of houses in Denmark with the house number 1
I presume that the way the API works is that it finds all the results before returning only the limited number back and therefore it takes quite some time to generate the result.
Instead you could consider that you only generates search result until there is enough to satisfy the limited amount.
Error screenshot

Thanks for reporting @sweco-dkgemr . We moved the issue to the repo with where the right people can take a look at it.

We are aware that adresse and husnummer is slow with single digit q parameters.

We do check if the search parameter has more than 1000 hits and use a simplified search to return a response faster. But this optimization is not implemented on adresse.husnummer and husnummer.husnummertekst.

I tried adding adresse.husnummer and husnummer.husnummertekst and single digit q parameters now responds in about 50ms. But this also slows down a few other searches. So we won't be pushing out an update before more testing.

Just for your information, right now we are working on another project, so this is on hold for some time, but hopefully we can look further on this soon again.

We decided that because Gsearch is a typeahead search we value a quicker response with longer search strings more than a quicker response with single digit parameters.

DocDemar also wrote a reply here that explains our thoughts more throughly.
#176 (comment) (in danish)