JVM Setting for performance as reading zip files.....??

I am not too familiar with VM options but I noticed that reading from Zip files is pretty process intensive. I am basically searching through zip files to find a file and then taking that inputstream for processing. I am basically looping through the zip file until i match the filename....pretty crazy.
Anyway, it is somewhat slower than I'd like so I want to see what I can do to increase performance. I am using the following parameters:
-Xms512m -Xmx1024M -Xss16M -XX:ThreadStackSize=256 -XX:MaxPermSize=256m
The machine I have is a single P4 3GHZ, ~3GB RAM.
Do those params look ok?
Thanks!
Michael

intensive. I am basically searching through zip
files to find a file and then taking that inputstream
for processing. I am basically looping through the
zip file until i match the filename....pretty crazy.I think it is pretty I/O intensive...hence slower
to see what I can do to increase performance. I am
using the following parameters:
-Xms512m -Xmx1024M -Xss16M -XX:ThreadStackSize=256
-XX:MaxPermSize=256m
Parameters look ok. I am not sure what -XX:ThreadStackSize will do as -Xss also sets the stack size? you can also try to pass -server and keep both Xms and Xmx to 1024 and see if it brings any improvement.
-BJ

Similar Messages

  • Setting the name of streamed zip file

    Hi,
    I have a servlet which creates a zip file with documents retrieved from a database. To create the zip file I am using the ZipOutputStream class and adding the documents one at a time to this object. This is all working fine.
    The problem I have is pretty simple, in that I can't seem to find a way in which to set the name of the zip file. This must be possible! At the moment it appears to be setting the name of the zip file to the name of the class that created it. In this case my class is called DocumentPacker and what comes back from the servlet is a zip file called DocumentPacker.zip. This wouldn't be so bad, but if you're creating the zip file for a user that does not have cookies enabled, it appends the session id to the end of the zip file name which i don't want.
    I am creating my ZipOutputStream like this:
    ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(response.getOutputStream()));
    and then adding the documents one at a time using a BufferedInputStream.).
    Any help on how to set the name would be much appreciated
    Thanks
    Claire

    Your servlet must set some headers on the HTTP response (Content-Type as "application/zip", Content-Disposition as "attachment; filename=yourfilename.zip")
    Read the RFC1806 document.
    Content-Type: application/zip
    Content-Disposition: attachment; filename=genome.jpeg

  • How can I install attachments for SAP notes with zip-files ???

    How can I install attachments for SAP notes with zip-files ???

    Can you elaborate on your question? How exactly is your question related to SAP NetWeaver Portal: Application Integration? If you are really asking how to install attachments contained in SAP notes, there is no automatic/general way and you should ask your question in the Software Support and Maintenance space to begin with. What SAP note(s) are you looking at installing?

  • Program to read zip files???

    im looking for a program to read zip files?Is this even possible on a mac? Im running 10.4.11 on my ibook g4

    Hello,
    What you need is a program that can OPEN .zip files. Go here: http://my.smithmicro.com/mac/stuffitexpander/index.html
    Download the free installation and just follow the instructions to open .zip files.
    Carolyn

  • Error reading zip file in Java 6

    We have a bespoke installer program that fails, intermittently, in Java 6 on Windows. After installing some files, it then fails with a stack trace like this:
    java.util.zip.ZipException: error reading zip file
         at java.util.zip.ZipFile.read(Native Method)
         at java.util.zip.ZipFile.access$1200(ZipFile.java:29)
         at java.util.zip.ZipFile$ZipFileInputStream.read(ZipFile.java:447)
         at java.util.zip.ZipFile$1.fill(ZipFile.java:230)
         at java.util.zip.InflaterInputStream.read(InflaterInputStream.java:141)
         at java.io.FilterInputStream.read(FilterInputStream.java:90)
         at com.XXXX.trent.installer.Installer.writeStreamToFile(Unknown Source)
         at com.XXXX.trent.installer.Installer.installFile(Unknown Source)
         at com.XXXX.trent.installer.PatchFileInstaller.installFile(Unknown Source)
         at com.XXXX.trent.installer.PatchFileInstaller.installFiles(Unknown Source)
         at com.XXXX.trent.installer.UpgradeInstaller$TpfAction.run(Unknown Source)
         at com.XXXX.trent.installer.UpgradeInstaller.runActions(Unknown Source)
         at com.XXXX.trent.installer.UpgradeInstaller.install(Unknown Source)
         at com.XXXX.trent.installer.TrentInstall$SoftwareInstallStage.install(Unknown Source)
         at com.XXXX.trent.installer.TrentInstall$UpgradeInstallWorker.install(Unknown Source)
         at com.XXXX.trent.installer.PatchInstall$InstallWorker.construct(Unknown Source)
         at com.XXXX.trent.utils.SwingWorker$2.run(Unknown Source)
         at java.lang.Thread.run(Thread.java:619)The same code works in Java 5 on the same environments that it now fails in Java 6 (1.6.0_16).
    Any ideas?
    Thanks.

    gimbal2 wrote:
    it is not weird, it is a bug in the application. Don't let the upgrade from Java 5 to Java 6 make you believe otherwise.It's a singularly bad exception message though. I would have thought that something from java.util might be a bit more explicit about what the problem is.
    Winston

  • Upgrade Plug in for CS4 to read raw files

    I have  PS4 and just bought a Canon 5d Mark III. PS now won't open my raw files. Can I get an upgrade plug in for CS4 to read these files? Thanks

    First you need to determine whether Adobe has released support for your new camera in Photoshop CS4.  To do that look at these two pages.  You'll want to find out the earliest version of Camera Raw that can support your camera, then what version of Photoshop can run that version of Camera Raw.
    Camera Raw plug-in | Supported cameras
    Camera Raw-compatible Adobe applications
    In your case, your 5D Mark III was first supported by Camera Raw version 6.7.  And we see that Camera Raw 6.7 was supported by Photoshop CS5, not Photoshop CS4 - so you cannot get direct raw support for your version of Photoshop.
    However, you CAN download and install the latest version of the free Adobe DNG Converter, which can take your raw files as input and put out DNG format files, which your version of Photoshop can open.
    Photoshop Help | Digital Negative (DNG)
    The DNG converter DOES work, but if you want maximal quality from your raw files (not to mention the convenience and ease of use of directly opening your CR2 files) I recommend upgrading to Photoshop CS6 or newer.  Adobe made substantial improvements in raw conversion quality in recent years.
    Adobe has a nice "Photographer's Bundle" subscription offer going right now.
    -Noel

  • Alternative APIs for reading Zip files?

    Hi all.
    At the moment, our application handles zip files by copying the zip file to the temp directory and then creating a new ZipFile. However, the larger the zip file we encounter, the slower this copy becomes. We also need random access to the Zip file, so the usual workaround of using ZipInputStream is also slow, although slightly faster for random access than copying the entire file.
    I raised a bug requesting a better constructor for ZipFile, but it was turned down as they seemed to think I didn't want random access.
    But does anyone know of any alternative APIs which can access Zip files in a more random access fashion? I've discovered a few other alternative implementations of ZipFile, but all of them so far have had this issue of requiring a File.

    intensive. I am basically searching through zip
    files to find a file and then taking that inputstream
    for processing. I am basically looping through the
    zip file until i match the filename....pretty crazy.I think it is pretty I/O intensive...hence slower
    to see what I can do to increase performance. I am
    using the following parameters:
    -Xms512m -Xmx1024M -Xss16M -XX:ThreadStackSize=256
    -XX:MaxPermSize=256m
    Parameters look ok. I am not sure what -XX:ThreadStackSize will do as -Xss also sets the stack size? you can also try to pass -server and keep both Xms and Xmx to 1024 and see if it brings any improvement.
    -BJ

  • How to read ZIP files(having PDFs,Image) using MQ Series link for R/3

    Hi,
    1)Is it possible to transfer a zip file (having an image or pdf) using IDocs in SAP 4.6C using MQ Series link for R/?
    Scenario: "MQ Series link for R/3" converts Business-Reports from a third-party software,into SAP IDocs.Each Business-Report contains one XML file and one ZIP file.
    2)Being on ABAP side,do I have to worry about how the zip file would be converted into IDocs?
    Detailed descrption:
    This scenario requires integration of a non-SAP software which talks in XML with SAP R/3(4.6C).The customer has decided to go with 'MQ Series link for R/3' (which integrates any non-SAP application running on IBM MQ Series to R/3,by converting data(in any format) into IDocs).He is not ready to go for XI.
    The Problem area is a functionality which requires the non-SAP software to send XML file along with an attached Zip file.So,XML document,basically,has a 'zippedFile' XML element having actual file in XML keyword 'file'.
    This XML document ideally, should be converted by the subsystem(MQSeries link for R/3) into IDocs i.e. into a stream which could be stored in a table on R/3 side and later, sent back to the non-SAP software through MQ Series link to be converted into zip-file again with corresponding pdfs,images.I want someone who has worked in a similar scenario to confirm this.

    Hi,
    I have a feeling I have posted this question in the wrong forum or maybe I will let you decide this.Any help would be appreciated (even the right forum name).
    My scenario requires integration of a non-SAP software which talks in XML with SAP R/3(4.6C).The customer has decided to go with 'MQ Series link for R/3' (which integrates any non-SAP application running on IBM MQ Series to R/3,by converting data(in any format) into IDocs).He is not ready to go for XI.
    The Problem area is a functionality which requires the non-SAP software to send XML file along with an attached Zip file.So,XML document,basically,has a 'zippedFile' XML element having actual file in XML keyword 'file'.
    This XML document ideally, should be converted by the subsystem(MQSeries link for R/3) into IDocs i.e. into a stream which could be stored in a table on R/3 side and later, sent back to the non-SAP software through MQ Series link to be converted into zip-file again with corresponding pdfs,images.I wanted someone who has worked in a similar scenario to confirm this.

  • Is there is abetter performance to read from file than my code for longfile

    Hi
    This is my code to read from file and show it in a text area ,but for long file it wait for along time to show the file ,Is there is better performance code?
    chooser=new JFileChooser();
                        chooser.showOpenDialog(sav);
                        File fe=new File(chooser.getSelectedFile().getAbsolutePath());
                        //out = new PrintWriter(new FileOutputStream(f));
                         in2 = new BufferedReader(new FileReader(fe));
                         str=in2.readLine();
                         if(str!=null)
                             nn2=str;
                         str=in2.readLine();
                        try{
                         while((str)!=null)
                         { nn2=nn2+"\n"+str;
                             str=in2.readLine();
                         }}catch(NullPointerException e){}
                         jta2.setText(nn2);
                          in2.close();
                       // in2 = new BufferedReader(new FileReader(fe));
                    } catch (IOException ex) {
              }catch(NullPointerException e){}
                  nn1=str;

    Yes you code would be slow because you are continually creating new string by concatenating one string to another.
    The easiest way is to simply use the read(...) method of the text area.

  • Error reading zip file containing an excel file

    Hi all,
    Using servlets I am able to zip an excel file using java.util.zip package. The excel file is created using POI API.
    While I save and extract the zip file on my machine and then open the file in MS Excel. Excel pops a message saying "MS Office Excel has encountered a problem and need to close" and it gives me an option to "Recover my work and restart MS Office Excel". I select the option and then MS Excel does a document recovery and I am able to view my data. I get an excel repair log file saying as follows
    "Microsoft Office Excel File Repair Log
    Errors were detected in file 'C:\Documents and Settings\JohnDoe\Desktop\excel\test.xls'
    The following is a list of repairs:
    Damage to the file was so extensive that repairs were not possible. Excel attempted to recover your formulas and values, but some data may have been lost or corrupted.
    I have attached my servlet code down below I suspect there is a problem with PrintWriter to output or do I need to use OutputStream to write excel data.
    Below is my servlet code:
    import java.io.*;
    import javax.servlet.*;
    import org.apache.log4j.Logger;
    import java.util.*;
    import java.util.zip.*;
    import java.net.*;
    import org.apache.poi.hssf.usermodel.*;
    import org.apache.poi.hssf.record.*;
    import org.apache.poi.hssf.util.*;
    public class ZipServlet extends HttpServlet {
         * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest,
         * javax.servlet.http.HttpServletResponse)
         public void doGet(HttpServletRequest request, HttpServletResponse response)
              throws ServletException, IOException {
              makeZip(request, response, "GET");
         * @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
         protected void doPost(HttpServletRequest request, HttpServletResponse response)
                   throws ServletException, IOException {
                   makeZip(request, response, "POST");
         public void makeZip(HttpServletRequest request, HttpServletResponse response, String methodGetPost) {
              Logger logger = Logger.getLogger(ZipServlet.class);
              try
                   int id=1;
                   ServletContext sc = getServletContext();
         HttpSession session = request.getSession();          
                   ConnectionPoolManager cpm = (ConnectionPoolManager)sc.getAttribute("CONNECTION_POOL_MANAGER");
                   ConnectionPool cp = cpm.getConnectionPool(id);
              createTestExcelZip(request,response,methodGetPost,session);
              } catch (Exception e2) {
         public void createTestExcelZip(HttpServletRequest request, HttpServletResponse response,
                   String methodGetPost,HttpSession session
                   )throws ServletException, IOException
              Logger logger = Logger.getLogger(ZipServlet.class);
              try
              {      //Create an Excel Workbook and placing value "Test" in the first cell
                   HSSFWorkbook wb = new HSSFWorkbook();
                   HSSFSheet sheet = wb.createSheet("new sheet");
                   HSSFCell cell=null;
                   HSSFRow row = sheet.createRow((short) 0);
                   short column = 0;
                   cell = row.createCell(column);
                   cell.setCellValue(new HSSFRichTextString("Test"));
                   HSSFCellStyle fontStyle = wb.createCellStyle();
              HSSFFont f = wb.createFont();
              f.setFontHeight((short) 200);
              f.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
              fontStyle.setFont(f);
              cell.setCellStyle(fontStyle);
              response.setContentType("application/zip");
                   response.setHeader("Content-Disposition","attachment; filename=zipExcelRecordFiles.zip;");
                   int BUFFER = 2048;
                   byte buf[]=new byte[300000];
                   ByteArrayOutputStream baos = new ByteArrayOutputStream();
                   ZipOutputStream zos = new ZipOutputStream( baos );
                   ByteArrayInputStream is = null;
                   BufferedInputStream origin = null;
                   byte[] b = null;
                   String fileName = null;
                   b = wb.getBytes();
                   fileName = "testExcelRecords.xls";
                   try
                   is = new ByteArrayInputStream(b);
                   origin = new BufferedInputStream(is, BUFFER);
                   zos.putNextEntry(new ZipEntry(fileName)); // Add ZIP entry to output stream.
              int count;
              while((count = origin.read(buf, 0, BUFFER)) != -1)
              zos.write(buf, 0, count);
              zos.closeEntry(); // Complete the entry
                   is.close();
                   }catch(Exception e)
                        logger.error(e);
                   zos.close();
              PrintWriter pr = response.getWriter();
                   pr.write(baos.toString("ISO-8859-1"));
                   pr.close();
              catch(Exception e)
              logger.error(e);     
         * @see javax.servlet.GenericServlet#destroy()
         public void destroy() {
    Any help would be appreciated.
    Regards
    jdcunha

    Jdcunha,
    I am new to the field but encountered the same problem and recently found a solution. Hope this helps.
    For my project I wanted to create individual Excel 2003 workbooks for each file I created. Excel would give me the same error it gave you when I used the same HSSFWorkbook object. I tried creating a new Workbook object each time, but ran into the same issue.
    I ended up fixing the error by creating a new instance of my write-to-excel class each time I wanted to create a new workbook, instead of just recreating a new HSSFWorkbook object. It works perfectly and the Excel errors don't show. It may also be important to note I used OutputStream, I did not try it with printwriter.

  • File Adapter to read Zip file and send it as input to another webservice

    Hi,
    I have the below requirement:
    1. A service will generate 3 attachments and place it in a particular directory.
    2. SOA service has to pick those 3 files and send those files as input to another custom application which will email.
    Design :
    1. First SOA will create an archive file of those 3 attachements and then file adapter will poll for that zip file in that location and send that file as a whole to the custom application.
    Query:
    Now my question, is the above design feasible? If so, how to configure the file adapter to pass the file as input to that custom application?
    Kindly do the needful
    Thanks,
    Priya

    You can accomplish this via java embedding activity...Create a java embedding, which will create a zip file.. this java code is easy to implement..
    You can also do away with un-necessary polling file adapter.. and you can use "Synchronous File Read" operation of File Adapter.. For Sync Read, you'll have to pass the zip file name, which you can easily fetch from java embedding activity..
    Let me know, if this doesn't work.

  • Reading .ZIP files using File Adapter

    Hi,
    I am using BPEL File Adapter to read files. The files to be read are XML files which are in zipped format.
    so how should I read these .zip files and extract the XML files from that.
    Thanks
    /Kiran.

    If the xml files are all in the same directory (not in any directory structure relative to the parent directory), you can do something like this.
    - create a bpel process to read the zip files as it comes into the directory]
    - Have a file adapter inbound for the receive
    - Call windows .bat command within the bpel process to run an unzip command on that directory
    - Have another bpel process that reads *.xml files and this will get kicked off.
    There are so many ways of solving this: like having a cron job to unzip the files coming in etc. But, if you have a directory structure for these XML files and if the structure is dynamic, it is difficult to configure the file adapter for that.

  • Read Zip File

    Hi,
    I have one zip file and want to read it file by file can you please tell me how can I achieve this???
    OR
    Can anyone please tell me about how can I get absolute path of the file which is resided in the zip file
    For example,
    if I have an zip file Test.zip which contains 4 zip files t1.xml,t2.xml.... and so on and resided on my local drive (D:).
    So, is there any way where I can get absolute path of these files like "D:\\Test.zip\\t1.xml","D:\\Test.zip\\t2.xml"
    Thanks in advance!!!

    rpdesh wrote:
    You can read the contents of the Zip file by creating ZipInputStream object.
    The constructor takes the file path and using the method getNextEntry() you will get the ZipEntry present in the zip file.
    Something like this...
    File file = new File("Zip file path here");
    ZipInputStream zip = new ZipInputStream( new FileInputStream( file ))
    ZipEntry zipEntry = null;
    while( zip.getNextEntry() != null )
    zipEntry = zip.getNextEntry();
    // Other operaions here
    <shakes-head/>
    That code is skipping over every other ZipEntry. Try this:
    for(ZipEntry zipEntry; (zipEntry= zip.getNextEntry()) != null;) {
         System.out.println(zipEntry.getName());
    }One could also use java.util.zip.ZipFile.

  • Read Zip File and output it to the Stream

    Hi,
    I really need help with this topic. I need to write a function which as input read the zip file (inside: jpeg, mp3, xml)
    and as output provide the output Stream of this zip file.
    public OutputStream readZipToStream(String sourceZipFile) { ....}
    I've tried something....
    public static OutputStream    readZipToStream(String src, HttpServletResponse response) throws Exception {
            File fsrc = null;
            ZipOutputStream out = null;
            byte buffer [] = null;
            FileInputStream in = null;
            try {
                buffer = new byte[BUFFER_CREATE];
                fsrc = new File(src);
                out = new ZipOutputStream(response.getOutputStream());
                ZipEntry zipAdd = new ZipEntry(fsrc.getName());
                zipAdd.setTime(fsrc.lastModified());
                out.putNextEntry(zipAdd);
                // Read input & write to output
                in = new FileInputStream(fsrc);
                while (true) {
                    int nRead = in.read(buffer, 0, buffer.length);
                    if (nRead <= 0)
                        break;
                    out.write(buffer, 0, nRead);
                out.flush();
                in.close();
            } catch (IOException ioe) {
                logger.error("Zip Exception: " + ioe.getMessage());
                ioe.printStackTrace();
                throw ioe;
            return out;
        } But the problem with this code when it returns ( I called from servlet: bellow)
    it ask user to save the file as servlet.jsp file. So I would have to rename it to zip file later.
    What I want to achive is it would ask to save zip file from the stream as name of the original zip file (if that is possible)
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <%
    OutputStream stream = null;
    response.setContentType("application/zip");
    target = mount_media + File.separator + "test_swf.zip";       
    try {
    stream = ZipUtil.readZipToStream(target, response);
    } catch (Exception ex) {
            System.out.println(ex.getMessage());
        } finally {
    if(stream != null) {
                stream.close();
    %>
    <%@page import="java.io.File" %>
    <%@page import="java.io.OutputStream" %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Insert title here</title>
    </head>
    <body>
    </body>
    </html>

    Hi oleg_s ,
    There's a contradiction of content in your JSP :
    response.setContentType("application/zip");
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">The html part of your JSP seems useless for what you mean to do. Therefore, instead of a JSP, you should use a simple servlet to send your zip file.

  • Read zip files created by ZipOutputStream

    Hello :)
    I am wondering if it is possible to create a zipfile using ZipOutputStream, which can be read using ZipInputStream with out using the ZipFile work-around discussed in http://forum.java.sun.com/thread.jspa?forumID=256&threadID=492219. This is no option for me, because we have a lot of client applications deployed, which cannot easily be altered.
    Are there any (third-party) libraries which I can use?
    -M1chael

    try it
    // These are the files to include in the ZIP file
    String[] source = new String[]{"source1", "source2"};
    // Create a buffer for reading the files
    byte[] buf = new byte[1024];
    try {
    // Create the ZIP file
    String target = "target.zip";
    ZipOutputStream out = new ZipOutputStream(new FileOutputStream(target));
    // Compress the files
    for (int i=0; i<source.length; i++) {
    FileInputStream in = new FileInputStream(source);
    // Add ZIP entry to output stream.
    out.putNextEntry(new ZipEntry(source[i]));
    // Transfer bytes from the file to the ZIP file
    int len;
    while ((len = in.read(buf)) > 0) {
    out.write(buf, 0, len);
    // Complete the entry
    out.closeEntry();
    in.close();
    // Complete the ZIP file
    out.close();
    } catch (IOException e) {

Maybe you are looking for

  • The data type DEC while downloading from ALV to EXCEL

    The data type DEC while downloading from ALV to EXCEL is giving some invalid data . Ex : In ALV field is the time difference in  hours:minutes   if the value is  :23 in Excel it will be 22:59 . Please Suggest immediately

  • Order in Process

    Hey folks: I have ordered stuff on BestBuy.com before but it has been awhile. I ordered a computer online and checked today and the Order is still stuck in "Received." To be honest I'm sort of use to the super quick "Shipped" message from Amazon.com

  • Sap.m.TableSelectDialog multiSelect behaviour in non multiSelect mode

    Hi All, I am using sap.m.TableSelectDialog in my application and i can see that Ok button is only provided when multiSelect property is set to true. Moreover, in non mulltiSelect mode as soon as an item selection(item click) is made, dialog closes. W

  • Expense Report showing comma instead of period (100,00% instead of 100.00%)

    Hi, Reports in Expense Reports part of ESS is displaying comma "," instead of period ".".  I am guessing a configuration setting somewhere is set wrong.  Would someone tell me how I can correct this? Thank you. Joon,

  • Snapshot of Website are blurry

    I have not used imovie that much. A client wants me to take snapshots of his website and have them scroll though on a dvd. I used a program called Paparazzi!, to make snapshots of the website. Then I put them into imovie. burned a dvd. On my computer