What is the best way to get output of script on another server?

177 views Asked by At

I have Nominatim (with open street maps) installed on a server.

On another server I have a database with multiple columns 3 of which are lat(latitude), lon (longitude) and address. The lat and lon columns are completed with coordinates and for the 3rd column I've written a script in PHP which queries Nominatim (on the other server) to get the address for the coordinates and updates the database when ran. At the moment the script uses cUrl ( creates the url like .../reverse.php?lat=XX&lon=YY ), gets the output (an xml) and updates the database.

The problem is that for 1000 coordinates it takes around 16 seconds. The script is running 8 cUrl threads at all time until all the fetching is done. I found that 8 threads is best because the server has an 8 core CPU.

I was wondering if there was a better solution to get the address faster. I was thinking of running exec via ssh or even exporting the database to the nominatim server and running exec there.

Before starting to write the code I wanted to get an opinion so I don't write a few hundreds of lines of code to get a worse result.

1

There are 1 answers

0
N Alex On BEST ANSWER

I managed to get the time down to 4 seconds by moving the script on the Nominatim server and using execs to run 8 scripts, each handling 1/8 of the data.