How can I measure memory allocation of a Java Application?

We built a web application that enables images to be loaded into a database through a servlet running on Tomcat. We have inconsistent behaivor when more than x number of people are loading images simultaneously. No doubt a memory allocation problem, but how can I measure it?
For example, I'd like to be able to create a graph showing the resources used against the number of people making uploads. I am using Linux and Tomcat/Apache.
I am hoping for something like Memory counters that are available for measurine Windows applications on MS Windows - comes with the Resource Kit. Does this type of tool exist for the Java/Linux market?

It is difficult to gauge memory usage from a Java application as the JVM handles garbage collection and even if objects are not referenced they might still be sitting in memory until the next garbage collect.
Anyhow, a way to query available memory is:
Runtime.getRuntime().freeMemory()
You can run this at the begining of a process and at the end and examine the difference. You should call System.gc() before each freeMemory() call in order to try to force garbage collection.
Another method would be to turn to the underlying OS. On linux you could use 'top' or 'ps'. With ps you could do something like:
ps -o rss,vsz,%mem <pid>
Where <pid> is the parent Tomcat process' id. The resulting three columns are:
- Amount of real memory used.
- Amount of virtual memory used.
- Percentage of real memory used.
'man ps' wil give you more options on how to use ps.
There are also fancy graphical stuff like 'gtop' as well.
Hope this helps.

Similar Messages

  • How can I put an image/s in Java Application?

    Hi to all.
    How can I put an image/s in Java Application?
    I can put some images in Java applet but when i try to put it in Java application there was an error.

    hey u can easily do it with JLabels...i found a Code Snippet for u
    public class MyPanel extends JPanel
    {private JLabel imageLabel; public MyPanel() {     Image image = Toolkit.getDefaultToolkit().getImage("myimage.gif"); // Could be jpg or png too     imageLabel = new JLabel(new ImageIcon(image));     this.add(imageLabel);  }}
    hope it helps
    Cheers,
    Manja

  • How Can I Take Print Screen With in java Application

    Hello Every One,
    Hope U all r fine.
    How can i take print screen with in java code,
    Please Help me out

    http://search.java.sun.com/search/java/index.jsp?qp=&nh=10&qt=%2Btitle%3A%22print+screen%22&col=javaforums

  • How Can I submit data to an external java application

    Hi Gurus,
    I've this requirement and I would appreciate if someone can provide me some guidance.
    My requirement is that we are building a webdynpro ABAP application inside our SAP system. This webdynpro application should be able to collect data from the user. When the user submits the data, this data needs to be processed by should an external java application for which we've the URL available.
    The data has to be sent to this external Java web application in the form of parameters to that application programatically through post method.
    Is there anyway we can code this in our webdynpro ABAP application.
    Please help.
    Regards,
    Sam K

    It isn't Web Dynpro ABAP functionality - per say - but you can use the class CL_HTTP_CLIENT for the ABAP server to act as a browser and make HTTP requests to other web servers.  This is how Web Services work from ABAP.  This class lets you build the request object and post it to an external server.  However you might consider if using a full blow Web Service might provide you with a better approach than just posting to an external URL.

  • How can I modify memory limitation to a Java thread?

    While I using
    java -Xms64M xxxx (class name)
    it seems that 64M is the biggest memory capacity Jvm allows.
    How if i wish to use more than 64M ?
    Ps: I am using Windows XP
    Thanks

    -Xms is the starting size. Try -Xmx to set the maximum size.

  • How to change heap memory size for general java applications (not applets)

    Hi. I made a java class which manipulates images and I sometimes get an out of memory error when the files are large. In these cases I can run it successfully from the command line using:
    java -Xms32m -Xmx128m myappbut as I run this class from a firefox extension, I can't use this technique.
    Could some one tell me how to set this globally? I've found a lot of info on setting it for applets in the control panel but that's it. I also tried editing my deployment.properties file by adding:
    deployment.javapi.jre.1.6.0_11-b03.args=-Xmx128mbut none of these options seem to work.
    Thanks for any help.

    Also you can use use [JAVA_TOOL_OPTIONS|http://java.sun.com/j2se/1.5.0/docs/guide/jvmti/jvmti.html#tooloptions], with more documentation here. JAVA_TOOLS_OPTIONS is available since 1.5. There is no direct documentation on [_JAVA_OPTIONS|http://java.sun.com/j2se/1.5.0/docs/guide/2d/flags.html] but was made available since at least 1.3.
    The recent existing forum thread [Java Programming - How to change the default memory limits for java.|http://forums.sun.com/thread.jspa?threadID=5368323&messageID=10615245&start=36] has a long discussion on the issue.
    You specified you are not using applets, but if you do, I would also suggest you use the next Generation Plug-in (since 1.6.0_10) that allows you specify the max memory in the applet without having to instruct the user how to make the change. See [JAVA_ARGUMENTS|https://jdk6.dev.java.net/plugin2/#JAVA_ARGUMENTS] for applets. Java Webstart uses resources.

  • How can we free memory?

    how can we free memory? what do "alter system flush shared_pool" and "alter system flush buffer_cache" commands do?

    If you want to reduce the size of the SGA, you could reduce initialization parameters that are taken into account to size the SGA: see the the Concepts Guide.
    The statements that you have mentionned do no reduce the size of the SGA allocated at OS level but only flush or empty the related caches.

  • How can I measure the copy speed of my compact flashcard to folder?

    how can I measure the copy speed of my compact flashcard to folder?
    I dont have a stop watch.

    Hi Steve Zavodny;
    Generally compact flash cards or basically slow because of them being flash memory and USB. What are you after here?
    Allan

  • How can I measure the hertz in a wave form?

    How can I measure the hertz in a wave form?

    As an example, this is from BBC Technical Requirements for HD material:
    3.1.1 Stereo line-up tones
    All stereo tracks must use EBU 1KHz tone (left ident). All tones must be sinusoidal, free of distortion and phase coherent between channels.
    Digital Audio Reference level is defined as 18dB below the maximum coding value (-18dBFS) as per EBU recommended practice R68.
    See also:
    http://www.bbc.co.uk/guidelines/dq/pdf/tv/tv_delivery_to_network_programmes_v1.2-2011.pdf
    for full document.
    And for BBC Radio:
    Not every Network requires tone. Check the delivery requirements with the commissioning network or click here.
    Reference tone, where used, should be at -18dBFS or PPM 4 on A, B and/or M.
    If submitting material with reference tone, tone and programme material must be have been monitored and measured through the same technical chain. The level of the tone must be equivalent to 0dBu and no less than 8dB below peak audio level for the programme material.
    THE LEVEL OF TONE MUST HAVE A KNOWN RELATIONSHIP WITH THE LEVEL OF THE PROGRAMME MATERIAL AND THIS MUST BE STATED; for example: “Tone at 8dB below peak programme level”.
    As a newcomer to digital sound (my background is camera) I confess to being somewhat confused. We are normally told to record at the highest level possible. So for voice podcasts I tend to record at about -6dB below peak for maximum volume, distributeds on MP3 files.
    But I can underatand that televison and radio especially for analogue transmission) may have limited headroom, hence the requirement for -18dB peak = 0dBM.
    I remember when we first rented out Digital Betacam cameras, some recordists were recording almost everything OVER -18dBM.
    I suspect that until we have an all-digital world, these requiremnents will still be in place.
    Many thanks to all. It's a ghreat community!
    Brian Rose

  • How can I reclaim memory/storage so I can burn a DVD with iDVD?

    How can I reclaim memory/storage so I can burn a DVD with iDVD?

    Move your iPhoto Library and/or your iTunes library to and external HD that is formatted OS X Extended (journaled) and run them from there. Be sure to try the libraries on the EHD before you delete them from the boot drive.
    This should easily free up the 25 GB minimum needed for iDVD to create and burn video DVD efficiently.
    Follow this workflow to help assure the best qualty video DVD:
    Once you have the project as you want it save it as a disk image via the File ➙ Save as Disk Image  menu option. This will separate the encoding process from the burn process.
    To check the encoding mount the disk image, launch DVD Player and play it.  If it plays OK with DVD Player the encoding is good.
    Then burn to disk with Disk Utility or Toast at the slowest speed available (2x-4x) to assure the best burn quality.  Always use top quality media:  Verbatim, Maxell or Taiyo Yuden DVD-R are the most recommended in these forums.

  • How can I measure the Graphics Card usage? I.e. percent load

    Hello,
    How can I measure the Graphics Card usage, like with the processor in Task Manager, but instead giving a percentage usage for the graphics card instead? Is there an easy way to do this, or would it require a lot of code? Is it even possible?

    Ah, so It's unlikely that Java3D will include anything for reading this data then? I was really aiming at measuring the GPU usage under this API which although i have limited knowledge using, I do at least have some knowledge - I wouldn't have a clue how to access any other API's!
    I'm using an NVidia TNT2 card at the moment, which is quite old.

  • How Can I Clean Memory, Cache...An​d Boost Memory On Playbook (like clean & boost memory on Blackberry phone)?

    Dear bros, I have a question which I concern about: How Can I Clean Memory, Cache...And Boost Memory On Playbook (like clean & boost memory on Blackberry phone)? I want to to this because I want my playbook run smoothly.
    Thanks all.

    The PlayBook manages memory through the OS, there's no 'memory cleaner' like on the BlackBerry phones.
    In the browser, there are settings to clear cache, cookies and history which do improve the browser performance.
    You may want to try and change the PlayBook multitasking mode. Go into Settings - General and change 'Application Behaviour'. Showcase is full multitasking (slower), Paused pauses all programs when minimised and makes the PlayBook save battery and run a little faster.
    Hope that helps.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!

  • How can I measure TREX server.

    Hi,
    I'm from Nakisa forum as below.
    <How can I calc sizing of TREX server
    I'd like to install minimum TREX server for Nakisa.
    A document of nakisa is written about nakisa server but it isn't written trex server.
    <https://websmp209.sap-ag.de/~form/sapnet?_SHORTKEY=01100035870000728933&_SCENARIO=01100035870000000202&>
    I found SAP note 1266024 which is written about sizing guide line of Nakisa but it's so difficult to calc.
    How can I measure TREX server and which minimun sizing is best to use Nakisa?
    Hope you can help us.
    Best regards,
    Makoto

    Hi Makoto,
    try the infos for TREX under http://service.sap.com/sizing.
    They are not made for Nakisa. But I am sure you will be able to roughly map them to your use case.
    best, Karsten

  • How can I measure how much Data I am using?

    As the headline say:-
    How can I measure how much data I am using?
    Thanks in advance.

    Not a problem at all - without wishing to push the point at all, the manual really is very good and worth a read ! although I must admit I have never read it all
    http://manuals.info.apple.com/en/iphoneuserguide.pdf

  • How can i measure distance ?

    i am making afire fighting robot that us camera to detect the fire i made the vi which find the fire through match pattern but now i want to measure the distance between the camera (which on th robot ) and the fire (which located in the image using match pattern) so how can i measure this distance?
    khaledyr 

    Ok... this is sad, I should be asleep now instead I'm here thinking about this problem.
    I've worked out how to do the distance caluclation with no extra H/W and only 1 camera - as Henrik said, the standard solution is triangulation, but you just want to measure distance, so I'm going to assume you're already pointing in the right direction.
    Assumptions:
    1) It is usual to use triangulation to to measure intenisity, this is because light will have 2 different distances to travel from source to sink.
    2) It is possible to use 1 sink if you use mirrors to increase the path of the light so you can have 2 seperate source -> sink distances.
    3) having 2 cameras (sinks) next to each other, one covered with a physical filter would have the same effect as the amount of light reaching the 2 sinks from the source will be different.
    ... following on from 3, it can be assumed that taking 1 image and applying 2 levels of filtering to it before processing will give the same result as if we had 2 different images. Careful setting of the software filter level will then allow it to remain contstant and then the system can be calibrated just as any other system would be calibrated:
    Measure the intensity of the source from sink A at distance X
    Measure the intensity of the source from sink B at distance X
    Measure the intensity of the source from sink A at distance Y
    Measure the intensity of the source from sink B at distance Y
    If Y=2X the calibration calulation is easy....
    Hope this provides more food for thought.
    James
    P.S. Lynn - currently a firefighter and worked for the emergency services ehh? Always good to see your posts when you have something to add. (Firefighter / Software programmer - what's the difference?)
    Message Edited by James W on 04-22-2010 10:56 PM
    Message Edited by James W on 04-22-2010 10:56 PM

Maybe you are looking for

  • Opportunistic cross-docking not working

    Hi All, We are trying to implement opportunistic cross-docking process. My understanding is that during the creation of the goods receipt TO the system looks for any open picking TO and accordingly directly moves material from 902 to 916 storage type

  • How do you make a MacBook Pro talk to an Epson printer?

    MacBook Pro OS X 10.6.8 (Thinking about getting  another MacBook) I had an Epson Artisan printer, got an Epson Workforce WF-3640 new in Jan, hardly used because I cannot make it do what I want it to do. Wireless connection is good. With the MacBook P

  • [solved] Changing date but not time

    Hello, I already searched the web but all examples how to change date involved changing time as well. date -s "7 April 2008 20:42:45" date -s "7 April 2008 20:42:45" I need a script that does the follow. 1. Save the current date 2. Change the date to

  • Reg:Outbound Queues are strucked in CRM

    Hi All,          After Extracting Data from CRM source system,the rercords are still displaying in the outbound queues of the CRM Source system.what might be the issue?In outbound queues the status is NOSEND or is it maintaining one more copy of the

  • How to edit iPhone 5 video in Premiere Pro CS6?

    I am new to Premiere Pro CS6 (new to video actually), and iPhones as well, and was wondering if there is a detailed procedure on editing iPhone 5 video in Premiere Pro CS6. Do I just attach the phone to the computer like any movie camera?