Java API performance issues

I have this HTTP request, I expected this, but WURFL is returning that. Please provide enough data to reproduce the problem.
pempek
Posts: 9
Joined: Wed Dec 09, 2015 2:20 am

Java API performance issues

Postby pempek » Wed Dec 09, 2015 2:48 am

Hi,

We're using Java API of WURFL and we're experiencing performance problems because of that. Analyzing WURFL call tree shows that there are several calls to java.lang.Class.getSimpleName(). In the attached example there are 4 calls (marked in red) which consume 10% of total WURFL processing time. Would it be possible to remove or disable that code?

http://snag.gy/MrMgH.jpg

Secondly, RISMatcher.match() internally builds a new ArrayList (marked in blue), which consume 70% of WURFL processing time. Can we do something about that? Cache it or use some static data?

Cheers,
Przemek

aaronp
Posts: 238
Joined: Wed Dec 09, 2015 12:39 pm

Re: Java API performance issues

Postby aaronp » Wed Dec 09, 2015 1:58 pm

Hi Przemysław,

Could you let me know what version of the API you are currently running?

Aaron

pempek
Posts: 9
Joined: Wed Dec 09, 2015 2:20 am

Re: Java API performance issues

Postby pempek » Thu Dec 10, 2015 2:07 am

The screenshot was taken at 1.5.2.1, but we're now migrated to 1.6.3.0 and it's still the same case.

aaronp
Posts: 238
Joined: Wed Dec 09, 2015 12:39 pm

Re: Java API performance issues

Postby aaronp » Thu Dec 10, 2015 2:54 pm

Przemysław,

Try running version 1.6.4.0; it is the latest version and we have made performance enhancements. Let me know how that goes!

Aaron

pempek
Posts: 9
Joined: Wed Dec 09, 2015 2:20 am

Re: Java API performance issues

Postby pempek » Fri Dec 11, 2015 6:28 am

Upgraded to 1.6.4.0, does a little bit better, but mainly still the same issues. java.lang.Class.getSimpleName() consumes 1.8% CPU time out of 13.5% which WURFL consumes in overall. I'm preety sure those calls could be avoided/disabled.
RISMatches still consumes ~70% of overall WURFL processing time.

http://snag.gy/Bwnzl.jpg

Can you help us with that?

aaronp
Posts: 238
Joined: Wed Dec 09, 2015 12:39 pm

Re: Java API performance issues

Postby aaronp » Fri Dec 11, 2015 10:41 am

Przemysław,

Thanks for the heads up. We are currently in the process of replicating this issue.

Are you able to provide us with more details on the Java environment you are testing in and how you are profiling your tests? Also, will you be able to provide us with a code sample?

Aaron

pempek
Posts: 9
Joined: Wed Dec 09, 2015 2:20 am

Re: Java API performance issues

Postby pempek » Fri Dec 11, 2015 11:58 am

This is a snapshot of real code performance in our PROD servers. Our code is basically calling WURFLEngine.getDeviceForRequest(). The thing is that each server handles few thousand of requests per second. The side effect of that is high memory allocation rate (~350 MB/s) which is probably why we're seeing ArrayList.init() takes so long. It'd be beneficial if WURFL wouldn't create that list internally. Maybe it could use another object or cache user agents internally.

aaronp
Posts: 238
Joined: Wed Dec 09, 2015 12:39 pm

Re: Java API performance issues

Postby aaronp » Mon Dec 14, 2015 11:16 am

Przemysław,

Are you able to send us a code sample of how you are configuring your `WURFLEngine` object?

Thanks,

Aaron

pempek
Posts: 9
Joined: Wed Dec 09, 2015 2:20 am

Re: Java API performance issues

Postby pempek » Tue Dec 15, 2015 2:59 am

Sure.

Code: Select all

WURFLResource wurflResource = new XMLResource(file);
WURFLEngine wurflEngine = new GeneralWURFLEngine(wurflResource);
wurflEngine.setEngineTarget(EngineTarget.accuracy);
wurflEngine.getDeviceForRequest(""); // initialize

aaronp
Posts: 238
Joined: Wed Dec 09, 2015 12:39 pm

Re: Java API performance issues

Postby aaronp » Tue Dec 15, 2015 11:44 am

Przemysław,

I would suggest using a cache; preferably the double LRU cache driver (10,000/25,000) for best performance.

Also, we will be making several improvements in our next API release.

Aaron

pempek
Posts: 9
Joined: Wed Dec 09, 2015 2:20 am

Re: Java API performance issues

Postby pempek » Wed Dec 16, 2015 2:34 am

Do you mean:

Code: Select all

wurflEngine.setCacheProvider(new DoubleLRUMapCacheProvider(10_000, 25_000));
I'll try that and come back with results.

pempek
Posts: 9
Joined: Wed Dec 09, 2015 2:20 am

Re: Java API performance issues

Postby pempek » Wed Dec 16, 2015 5:23 am

I increased those values 10 times and now it works far better than at then beginning. Thanks for that tip and we're waiting for new version to come!:)

aaronp
Posts: 238
Joined: Wed Dec 09, 2015 12:39 pm

Re: Java API performance issues

Postby aaronp » Thu Dec 17, 2015 11:44 am

Przemysław,

Java 1.6.4.1 for both OnSite/InFuze will be available by tomorrow, if not today, in your file manager.

Aaron

pempek
Posts: 9
Joined: Wed Dec 09, 2015 2:20 am

Re: Java API performance issues

Postby pempek » Mon Dec 21, 2015 7:24 am

Ok. Waiting for it to appear :)

aaronp
Posts: 238
Joined: Wed Dec 09, 2015 12:39 pm

Re: Java API performance issues

Postby aaronp » Mon Dec 21, 2015 9:54 am

Hi Przemysław,

Java 1.6.4.1 has been released and you should have access to download.

Also, one of our engineers have notified me that the correct numbers are: double lru cache sixing is UA, deviceid. Good numbers are 100000, 25000 or 60000, 15000 (User Agent cache size, device cache size)

Code: Select all

wurflEngine.setCacheProvider(new DoubleLRUMapCacheProvider(100000, 25000));
Let me know if you still do not have access to the latest update!

Aaron

pempek
Posts: 9
Joined: Wed Dec 09, 2015 2:20 am

Re: Java API performance issues

Postby pempek » Tue Dec 22, 2015 5:41 am

Looks nicer, no calls to getSimpleName() are made. With the caching added, our servers perform now far better. Thank you!


Who is online

Users browsing this forum: Google [Bot] and 1 guest