I need to profile a server-client Java application (based on Jersey/REST FYI).
I have learned around that profiling remote servers is a real pain with TPTP, so I want to keep it simple :
I have written a test case (a "main") that runs a standalone server (Grizzly) and a client (within a separate thread) and process some load tests.
I can run it in profiling mode (with Eclipse/TPTP), but I would like to isolate my core methods from all the noise of the server and client setup.
I there a mean to programmatically enable / disable the TPTP profiling in my code, at some check points?
I would recommend using Netbeans for profiling your app, irrespective if you're using it for development. It can filter by package, class, or method so you only see what you want, as well as having nifty profiling points (things like stopwatches but way more powerful). You can do things like:
Sorry for all the screenshots, but IMHO they help people who have never profiled before and are wondering what it can do for them.
Related
There was a problem with the high response time of my Spring application.
My colleagues advised me to use VisualVM, simultaneously running the load using Jmeter. I want to check which method takes the most time
However, in VisualVM I get an uninformative answer - there are no methods of my application.
Can you tell me if I'm going the right way and how to display information on methods inside the application?
I think you need to go for a more comprehensive tool like JProfiler or YourKit or an APM tool if you have an appropriate license (there are free and open source like Apache Skywalking as well)
Theoretically it's possible to use JVisualVM however it's better to go for the "snapshot" mode, check out Profiling With VisualVM article series for instructions.
You can also get some JMX metrics using JMeter's PerfMon Plugin
I'm looking for a way to test the different functionality of my JavaEE server application. I first tried to do it with Junit and TestNG, but building the different scenario was too tedious.
What i'm searching is a tools that will simulate an user using my server application trough his browser, and then once this scenario is established i could check the output and verify if it's working.
Here an exemple:
An user connects to the server, the server application interface is displayed.
He executes the functionality to modify his personal datas
He modifies the different that he want to change.
He saves the modifications.
Then what i want to check is the actual state of the data in the database.
What i need is something that will simulate the action he did with his browser like i said above...
I've read different article about different tools that could do the works but i'm not sure because i don't really know what to type in google.
I discovered Jmeter (that is not working with my application because of web socket) and the Grinder.
The Grinder seems to be interesting but most of the things i've read about refers to it as load testing tools, which is not what i'm looking for.
Can someone experienced tells me if i can do what i want with the Grinder ?
You can use scripting tools like: Sikuli(Record Playback & Scripting) or Automa (Component Identification Scripting)
The most popular tool currently is Selenium. It will certainly do the job. I would also mention Geb because it provides more convenient API when compared to Web Driver.
I'll also let myself to give an advice, although it doesn't relate directly to your question.
If your project is big enough (4-5 teams over a couple of years can deliver a lot of code), you should think what to automate.
These tests can be very heavy both in terms of CPU load and in terms of time.
So if you'll rely ultimately on these tests, your build will run ages and will be potentially unstable.
So these tools should be used only to complement unit/component and integration testing that should exist anyway and they will use completely different tools.
Also in UI, consider using various testing techniques that would test only the UI side (mock the server endpoints and so on).
We've been working on a quite specific coding project recently. What we want to do is:
Use Java applications to do tasks impossible (or at least very diffucult) to accomplish in PHP
Control those Java programs with Joomla 3.0
We've found out that there is support for PHP Scripts in Joomla by using this extension or we could create our own module by using this.
My question is: Is there a way to call programs / execute commands in a more practical manner than using the PHP functions shell_exec() or exec() or using popen()?
Especially since these Java programs will run under a different user (on a Windows Server ...).
Thanks in advance!
Do not use such components. This is dangerous no matter what creator says. I'm Joomla extension developer and believe me it can ruin your application and make more problems and benefits. Depends on what you want to archive and how big will be your project you have few possibilities:
1. Create component that will execute commands
Something similar to what U did but based on custom created component. Its fastest and cheapest way. Problem starts when your Java application will use more resources then website (interface). So its more like good solution for start.
2. Create component that will contact application written in Java via API
This is good solution if your Java application use a lot of resources. You can run it on several servers, manage servers load so clients gets results faster etc. This gives you many possibilities, flexibility but is
harder to implement and will cost more.
3. Just use applet running on clients computer (if your application allows it)
Simple, effective, costs less but also can be impossible depending on what tasks application have to run.
At present I have a set of benchmark tests for recording the speed at which a Java application connects submits and returns data from varying RDBMS housed on varying server platforms. The application uses a simple algorithm for recording the time taken associated with each test. The application itself is a simple Java interface for a user to specify the tests, this seemed easier than hard coding each test or using an IDE to perform each test (bare in mind with the combination of RDBMS, Server O.S and client O.S there are in the region of several hundred individual tests). I would like to further my findings by introducing the cpu usage and memory usage during these tests on the client side where the application resides, I could hard code the algorithm for doing so in my application(My Preference) or use a third party software for monitoring this (Bare in mind it would need to be suitable for cross platform use, Windows 7, Solaris and Ubuntu).
So my question is how could I record the usage of CPU and Memory during a test through either hard coding in my Java application or Using a third party software? If you believe a third party would be the solution please could you mention the actual product and how it is possible to do this?
Thankyou to all who take the time to answer.
Check VisualVM. Has a lot of features
I used VisualVM and help to much to get memory leaks.
Here has a video who show most important VisualVM features
There are plenty of commercial products for this. JProbe is my favorite these days, but I'm also using YourKit. In the free arena, Eclipse has "TPTT" -- "Test Platform something something" -- but it seems to be a rare person who can actually get the darn thing to work. Never works for me.
In my project, we are using FEST for GUI testing. We have been persuaded that FEST is powerful, however displaying frames every time is a waste of time. Also we are using continuum and FEST doesn't work with continuum because continuum's maven can't open the GUI (by the way we use maven too and our tests pass in maven on our local machine).
How can I solve this problem?
If it is not possible, please inform me.
FEST by design displays the UI. If you don't want the tests to block your desktop, the only way is to use some kind of virtual desktop:
- Xvfb (Linux)
- VMWare (Linux, Windows)
- Auto-logon (Windows - not tested, found somewhere in docs)
You can read more about it here: http://docs.codehaus.org/display/FEST/Continuous+Integration
May or may not be related, but in order to speed up your tests have a look at:
Robot.settings().delayBetweenEvents()
This controls how fast mouse and keyboard events are.
You can use the Cacio-tta module of Caciocavallo... I know it sounds like I'm talking about cheese, but it's a real project:
http://openjdk.java.net/projects/caciocavallo/
The testing framework consist of a runner that plugs into Fest ("CacioFESTRunner") and allows you to run the test without disrupting your normal flow, you don't need any special server, since cacio has all that is needed.
It is also fully synchronous, so you don't need to worry about spurious failures due to drawing command being dispatched asynchronously, and it is available as a maven package so it is very easy to setup.
You can find more info here:
http://jroller.com/neugens/entry/caciocavallo_1_1_released
Have a look at WindowLicker:
A framework for the test-driven
development of Java systems through
the GUI.
I haven't used it myself, but it's written by some of the same people that wrote JMock, so it should be a good quality utility.