Hi Iain, Thanks for your help, I think I will need luck indeed :) I made a snippet with multi threading rendering and it work as expected (80 to 1100 ms for 500/500px ~ 50 features), with and without use of H2 database:
https://github.com/remipassmoilesel/abc-map2/blob/master/src/test/java/org/abcmap/tests/core/rendering/MultiThreadRenderingTest.java But when I use StreamingRenderer in my project, in similar conditions, it is terribly slow. That can be visible in my project (as you can see on screenshot below) What is really weird is that only features rendering is slow, and they are simple. Raster data is displayed very well and fast. https://github.com/remipassmoilesel/abc-map2/blob/master/screenshots/rendering_issue.jpg I tried to render from a DefaultFeatureCollection, nothing changed (results on screenshot) I measured database loading time, and it does not appear that is the slow part of code, it is always around 10ms. I thought about synchronization problem, I tried to create renderer pools, or a renderer object each time I need one, nothing changed. For now, I'm using one renderer by layer. I measured rendering time by using exactly this code: // draw image long before = System.currentTimeMillis(); renderer.paint(g2d, new Rectangle(imgWidth, imgWidth), bounds); renderTime = System.currentTimeMillis() - before; And rendering is about 2000ms, up to 4s and plus. Rendering code: https://github.com/remipassmoilesel/abc-map2/blob/master/src/main/java/org/abcmap/core/rendering/partials/PartialRenderingQueue.java You can see a working example of whole project on Github. A demo project is loaded on startup with random features. You can draw lines on, and see in real time how many milliseconds it take to render map. Project build: $ git clone https://github.com/remipassmoilesel/abcmap2 $ cd abcmap2 $ git submodule init $ git submodule update $ cd lib/imagej-surf/ $ mvn install # I use a custom version of JDBC Mosaic plugin, it pass unit tests $ cd ../geotools/modules/plugin/imagemosaic-jdbc/ $ mvn install $ cd ../.. $ maven compile $ maven exec:exec # launch a demo project with statistics Feel free to make any suggestion, I am feeling a bit overhelmed on that ! On 22/12/2016, Iain Matcham <i...@jumbletree.com> wrote: > Hi Remi, > > We routinely plot hundreds of thousands of features - this can take the > StreamingRenderer 5 or 6 seconds. However we have a test that uses a > two-asset feature collection - read from a CSV file - to create a > 400x300px image - quite similar to your setup. I timed this and > StreamingRenderer completes rendering in around 110 ms. I increased the > number of features to 20 and rendering time was not significantly different. > > Replacing this with an empty feature collection, rendering consistently > takes around 90ms > > So for me the difference between no features and a few features is 20ms, > not 4s as you are experiencing. > > Are you sure that your latency is not to do with data retrieval? As an > additional test, could you try copying your 40 features to a > ListFeatureCollection first and rendering from that - and just time the > rendering step to ensure that it is not H2 that is causing the slowdown? > > Otherwise, can you provide a code snippet that could be used to > reproduce your situation? I'd be happy to reproduce your situation and > try to help. > > Good luck! > Iain > > On 23/12/2016 5:02 a.m., Rémi Pace wrote: >> Hi list ! >> >> I use StreamingRenderer to generate fixed-size images (500/500px) >> which are cached in an H2 database and updated when needed. It works >> well, but performances are random. I searched low code and all is >> around StreamingRenderer. >> >> On an empty feature layer, first images are produced in 50 or 100ms >> but with just 30 or 40 features it go up to 4 seconds (sometimes 20 >> seconds) for each small picture (500 x 500px) >> >> However, raster data is displayed on background in the same time in >> just 20 or 50 ms. And this data is extracted from H2 database too. >> >> I think the only weird thing in my code is that the coordinates are a >> bit fanciful (like in a CAD) with points like 172/190 2000/2100, ... >> but I am using the GENERIC_2D CRS. >> >> I tried to play on Rendering Hints without success. I tried in debug >> mode and without, nothing changed. I usually run OpenJDK 1.8 but I >> tried on Oracle 1.8, it seems a bit better but it is always about 2s. >> >> Someone know how can I fix that ? Thanks for your help ! >> > > -- > Sent from my ZX80 > > > --- > This email has been checked for viruses by Avast antivirus software. > https://www.avast.com/antivirus > > > ------------------------------------------------------------------------------ > Developer Access Program for Intel Xeon Phi Processors > Access to Intel Xeon Phi processor-based developer platforms. > With one year of Intel Parallel Studio XE. > Training and support from Colfax. > Order your platform today.http://sdm.link/intel > _______________________________________________ > GeoTools-GT2-Users mailing list > GeoTools-GT2-Users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > -- *** Rémi PACE http://remi-pace.fr https://github.com/remipassmoilesel Photographie: http://toutes-les-bulles-eclatent.fr -- *** Rémi PACE http://remi-pace.fr https://github.com/remipassmoilesel Photographie: http://toutes-les-bulles-eclatent.fr ------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today.http://sdm.link/intel _______________________________________________ GeoTools-GT2-Users mailing list GeoTools-GT2-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users