Java API performance issues
Java API performance issues
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
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
Re: Java API performance issues
Hi Przemysław,
Could you let me know what version of the API you are currently running?
Aaron
Could you let me know what version of the API you are currently running?
Aaron
Re: Java API performance issues
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.
Re: Java API performance issues
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
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
Re: Java API performance issues
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?
RISMatches still consumes ~70% of overall WURFL processing time.
http://snag.gy/Bwnzl.jpg
Can you help us with that?
Re: Java API performance issues
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
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
Re: Java API performance issues
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.
Re: Java API performance issues
Przemysław,
Are you able to send us a code sample of how you are configuring your `WURFLEngine` object?
Thanks,
Aaron
Are you able to send us a code sample of how you are configuring your `WURFLEngine` object?
Thanks,
Aaron
Re: Java API performance issues
Sure.
Code: Select all
WURFLResource wurflResource = new XMLResource(file);
WURFLEngine wurflEngine = new GeneralWURFLEngine(wurflResource);
wurflEngine.setEngineTarget(EngineTarget.accuracy);
wurflEngine.getDeviceForRequest(""); // initialize
Re: Java API performance issues
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
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
Re: Java API performance issues
Do you mean:
I'll try that and come back with results.
Code: Select all
wurflEngine.setCacheProvider(new DoubleLRUMapCacheProvider(10_000, 25_000));
Re: Java API performance issues
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!:)
Re: Java API performance issues
Przemysław,
Java 1.6.4.1 for both OnSite/InFuze will be available by tomorrow, if not today, in your file manager.
Aaron
Java 1.6.4.1 for both OnSite/InFuze will be available by tomorrow, if not today, in your file manager.
Aaron
Re: Java API performance issues
Ok. Waiting for it to appear
Re: Java API performance issues
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)
Let me know if you still do not have access to the latest update!
Aaron
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));
Aaron
Re: Java API performance issues
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: No registered users and 7 guests