Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Openlr Performance Issue #33

Open
sudhaharv77 opened this issue Dec 5, 2019 · 13 comments
Open

Openlr Performance Issue #33

sudhaharv77 opened this issue Dec 5, 2019 · 13 comments

Comments

@sudhaharv77
Copy link

Hi,

We are developing the traffic project, we are getting the traffic data from
tomtom(https://traffic.tomtom.com/tsq/hdf/ARE-HDF-OPENLR/149d7921-d010-43cd-8e0d-83e5df700500/content.proto) as of now URL is not open for us. we are using the sample proto data.

Here the issue is, when we try to decode the data using openlr(openlr.decoder.OpenLRDecoder;) its consuming more time to return response( example 1 sec for 1 record).

We have almost 43000 records needs to process approx. its takes almost 40 mins which run by 200 threads.

Could you please help to sort out issue.

Java Sample:

ByteArray openLRByteArray = new ByteArray((byte[]) trafficFlow.getLocation().getOpenlr().toByteArray());
LocationReference locRef = new LocationReferenceBinaryImpl("", openLRByteArray);
Location decodedLoc = new OpenLRDecoder().decode(decParam, locRef);

Thanks,

@ghost
Copy link

ghost commented Dec 6, 2019

I have a few questions about the issue:

  • What map implementation are you using to decode the records?
  • Are you using the maploader-tt-sqlite module and an associated SQLite database?
  • If so, how large is the map? Can you perform a count of the records in the Line and Node tables?

The map implementation in the maploader-tt-sqlite was designed as a simple test map format for getting started. For your task I would suggest implementing the MapDatabase interface using a proper spatial database.

@sudhaharv77
Copy link
Author

Hi,
Thanks for your valuable response, Please spare some time to read my comments

fyi info we are below dependencies

Capture

Please find my answers,

What map implementation are you using to decode the records?

  • We are getting the MapData list based on Zone from our DB(Data is coming from GEO db)

Capture

- [ ] openlr.map.MapDatabase ojbect is created as below
Capture

- [ ] prepare openlr decode param using below
Capture

- [ ] finally decoding as below.
image

finall results is

Capture

Are you using the maploader-tt-sqlite module and an associated SQLite database?

Yes

openlr-mapLoader
tt-sqlite
1.3.0

If so, how large is the map? Can you perform a count of the records in the Line and Node tables?

Capture
Capture

@ghost
Copy link

ghost commented Dec 9, 2019

Thanks for posting the info! Could you try reducing the number of threads from 200 down to 10? I think the number of threads is too high and they are likely competing for resources. This might increase the throughput.

You seem to be getting throughput of about (40m * 60s * 1000ms / 43000 records) = 55 milliseconds per record. The OpenLR sqlite database was not really designed for high-performance but rather as a simple example implementation of a map to get started with OpenLR. I think you are just hitting on the limits of sqlite. You could try, for example, implementing MapDatabase using an in-memory copy of the map. This would perform much better.

@sudhaharv77
Copy link
Author

Hello Stephen,

Thanks for you valuable feed back.
Yes as you said, we can achieve our goal if sqlite file minimal. As per our records(43000 min) its takes long time to process with 32gig machine. We need to implement In memory concept as you suggest.

i could not found any API's support for IN MEMORY with openlr.

Could you please help us to provide any snippet or steps to implement IN MEMORY.

Thanks.

@ghost
Copy link

ghost commented Dec 17, 2019

You are right. We don't have a in-memory implementation of the map database. This is something we would like to do in the future. To achieve this:

  • the following classes would need to be implemented openlr.map.MapDatabase, openlr.map.Line and openlr.map.Node.
  • All lines and nodes of the map would be loaded into memory. Spatial indexes would need to be built for all lines and all nodes to enable quick searching around a point. An RTree implementation such as https://locationtech.github.io/jts/javadoc/org/locationtech/jts/index/strtree/STRtree.html might be good for this task.
  • Indexes would also need to be built to enable quick retrieval of line and node by ID.
  • Some geometrical operations would need to be implemented such as getGeoCoordinateAlongLine. A library such as JTS could also be used here to reduce the implementation work.

@sudhaharv77
Copy link
Author

Hi stephencurran,

Thanks again,

Sorry for the late reply, i understand that openlr do not have in-memory implementation
is it any road map to implement in-memory in future?

Can you suggest instead Java, is there any other technologies to process the data faster with Openlr.

Regards
Sudhahar

@duel-adn
Copy link

Hello @sudhaharv77,
we have a very fast OpenLR decoder implementation (6k-50k identifiers per second on a 4 core machine with 16GB of RAM). If you are still interested, you can contact me.

Best,
antonio

Hi stephencurran,

Thanks again,

Sorry for the late reply, i understand that openlr do not have in-memory implementation
is it any road map to implement in-memory in future?

Can you suggest instead Java, is there any other technologies to process the data faster with Openlr.

Regards
Sudhahar

@sudhaharv77
Copy link
Author

sudhaharv77 commented Mar 25, 2021 via email

@duel-adn
Copy link

duel-adn commented Mar 25, 2021 via email

@sudhaharv77
Copy link
Author

sudhaharv77 commented Mar 30, 2021 via email

@sudhaharv77
Copy link
Author

sudhaharv77 commented Mar 30, 2021 via email

@sudhaharv77
Copy link
Author

sudhaharv77 commented Apr 26, 2021 via email

@duel-adn
Copy link

duel-adn commented Apr 27, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants