JxBrowser takes huge RAM - java

I am using jxbrowser to make an automation test application.
After run a lot of automation tests(login to a webpage, click some button, perform some UI interaction), I reallize that the jxbroser-chromium.exe took so huge RAM, Even after doing some automation tests, I load "about:blank" page
Note that I use only one instance of Browser & BrowserView
Is there any way to clean & clear RAM when using jxbrowser?

JxBrowser is based on Chromium engine. Chromium engine is running in the jxbrowser-chromium.exe process. JxBrowser doesn't control the memory in this process. All memory management is done by Chromium engine. If you see that the process allocates too much memory, then it means that Chromium engine decided to allocate this amount of memory for some reasons.
I believe if you do the same automated tests in Google Chrome tab, you will see the same memory usage issue. As far as I know there's no Chromium API that would clear the memory of an existing tab/browser. To clear the memory I can only suggest that you dispose Browser instance and create it again.

Related

Selenium using too much memory

I'm using selenium on python 3.5 with chrome webdriver on a ububtu vps, and when I run a very basic script (navigate to site, enter login fields, click), memory usage goes up by ~400mb,and cpu usage goes up to 100%. Are there any things I can do to lower this, or if not, are there any alternatives?
I'm testing out selenium in python but I plan to do a project with it in java, where memory usage is a critical factor for me, so the same question applies for java as well.
I believe your memory usage problem is caused by selenium. AFAIK it runs on webkit, which is also used by Googles Chrome browser. And chrome is well known for it's excessive memory usage.
This might help:
Selenium github issue #4988
Don't forget drive.close() in your code , if you don't close your driver, you will have a lot instance of Chrome.
This should not happen I believe unless there is a leak.
Please try install nmon on your machine and run the test.
Nmon
This would help in figuring out exact cause of high CPU utilization and resolve your issue.

Progammatic browsing performance issues

I'm using Selenium (in Java) to do programmatic browsing (Firefox) and, to speed up page loading, I'm going through a programmatic Java proxy running in the same application (Browsermob) to prevent the loading of external content (ads, etc) as I only need website's hosted content.
The application is browsing through hundreds of thousands of pages but unfortunately, after a few hours, speed is reducing significantly (from ~5s/page to ~30s/page).
Can it be related to browser cache size? Proxy cache? How to check?
Any pointer or hint would be more than welcome!
Many thanks,
Tom
Hi I would change your User Agent to something like Chrome to check wether or not Firefox is the problem or if its down to memory management in your app.
Are you closing down the Browser after a number of views? remember the browser will cache and start to take up a lot of memory. It may be better for you to use a text based browser (Lynx) in your app that removes a lot of overheads if your are simply going for text content.
Id kill the process every so often as memory leaks will cause the process to slow over time.

Java Appium Automation Memory Testing

have a set of automation scripts that were written in Java TestNG with Appium running across iOS and Android devices. What I'd like to do is at certain intervals when performing certain actions, check the available memory of the device, or the memory that the application under test is using. The purpose of this would be to find memory leaks and/or other performance issues over a period of time.
I am aware of using the Instruments tool in OSX to track memory, but I'd like to do this checking programmatically such that it can be contained into our CI process and data can be collected over a period of time instead of manually.
Any tips/tricks on how to accomplish this?

How can you force a heap dump on a java-based web application that goes slowly in order to figure out where that slowness occurs?

We are currently using a modified version of Atlassian Confluence v.3.5
and have created a space containing large number of pages (about 5000) and large number of attachments (about 10000).
When navigating to the home page of this big space it takes about 3 minutes to load completely (the safari web browser shows a spinning wheel indicating page resources are still being loaded).
In these 3 minutes, we are unable to determine where the processing time is being spent.
We turned on confluence's profiling feature but it did not help because there was not much output in the log file.
The confluence process (which is a java process) is using about 8.2% CPU during the 3 minutes. How can I figure out what the process is doing?
You have all these options:
HeapDumpOnCtrlBreak
HeapDumpOnOutOfMemoryError
Jmap
HotSpotDiagnosticMXBean
A Thread Dump may also be useful. You can use it to figure out what the threads are waiting on.
You can also use a profiler. The best one I've used is JProfiler. But there's other ones available that are free and open source. I think netbeans comes with one. And sun makes one called VisualVM.

monitor Java process memory in realtime

I have a java application that its memory starting to jump and fall after few days.
Is there a tool that can show me the variables/members sizes during run/debug in real time?
Debugging it with eclipce is impossible.
Check out jhat and jmap.
In the longer run, consider adding a monitor to your app (with JMX, or write your own). It may help you in many situations in future.
Install this: http://visualvm.java.net/eclipse-launcher.html and then launch using Eclipse. This does not use the debugger, but launches the VisualVM application which lets you monitor the app. You'll need to go into the Run Configurations.. settings to set this up, and select VisualVM launcher at the bottom (Select Other... -> VisualVM launcher). You'll need to go into Preferences to set up the location of VisualVM too.
(On later Eclipse versions, drop it into the drops folder, unpacked).
If you're using >JDK6 and can get access to the machine then jvisualvm.exe may work, part of the JDK (in the bin dir)
yourkit (http://www.yourkit.com/) can do that, but expect a HUGE degradation on the performance of the app, as it has to track the size of each object.
I think it's better if you run yourkit with a few less invasive options, and then you can take snapshots of the memory usage.
I forgot to add, that with yourkit you can run the application without almost any instrumentation (which will slightly degrade the performance of the app) and when the problems start ocurring, you can enable the more heavy weight profiling while the app is running.

Categories