Performance slow using url BufferedReader

I'm reading the contents of a url using BufferedReader, it takes a while to read the url into my application, what could be done to speed it up. Here's the code.
DiscovererUrl = https://url_to_site
URL myurl = new URL(DiscovererUrl);
HttpURLConnection con = (HttpURLConnection)myurl.openConnection();
InputStream ins = con.getInputStream();
InputStreamReader isr=new InputStreamReader(ins);
BufferedReader in =new BufferedReader(isr);
StringBuffer inputLine=null;
StringBuffer entirehtml=new StringBuffer();
String entirehtmlafter = "";
StringBuffer str = null;
StringBuffer str2 = null;
try{
while ((inputLine = new StringBuffer(in.readLine())) != null)
entirehtml.append(inputLine);
catch (NullPointerException npe){}
in.close();
isr.close();
ins.close();
con.disconnect();

it takes a while to read the url into my applicationWhat is 'a while'? Maybe it's because the site is not responding fast anyway.
Don't forget that with SSL it's slower.
By the way, you don't need to instantiate a StringBuffer for each line read:
while ((inputLine = in.readLine()) != null)
    entirehtml.append(inputLine);

Similar Messages

  • I need to achieve performance in using URL

    Which api better supports in increasing performance regarding URL
    * org.apache.tomcat.util.net.URL or java.net.URL*

    It's the requirement by our client. As of now we are using java.net.URL and running application with sequence of requests and responses. The requests are as high as more than 6000. So performance issue is came into picture. Our client needs to use apachi api. We dont know whether it'll increase performance or not, just to know whether apachi api helps us in this matter???

  • Server  performance slow using sql server 2005

    Dear Team,
    Kindly assist me in solving the performance issue .
    The server is very slow and it is taking more time.,
    SAP version details:
    - SAP ECC 6.0 sr3 version.
    -DB SQl server 2005.
    performance is very slowi,ts is taking time to execute the Transactions.
    Appreciate for quick response.
    Thanks&Regards
    Kumarvyas

    Dear Team,
    In T- code:   DB13
    Space overview
    Found an error:"  ERROR CONDITION EXISTS- CHECK FILES TAB ".
    in the files TAB:  Datafiles: 
    Exception in red  for <SID>DATA1, :  <SID>DATA2,:  <SID>DATA3
    Freepct: 0,0,0,
    Free pct :  Free percentage of space in a SQL Server file tab
    How to extend the The DATA files in SQL server 2005
    Reagrds
    Kumar

  • How do I access "Firefox is NOT compatible with this application. For best performance, please use Internet Explorer 5.0 and above...." web sites; when I try to download any alternate browser, then a warning that alternate is "imcompatable with your opera

    How do I access websites that warn: "Firefox is NOT compatible with this application. For best performance, please use Internet Explorer 5.0 and above...."? When I try to download any alternate browser, all I get is another warning that the alternate is "not compatible with your operating system." Is Firefox preventing this? The site listed below is a job application site. I've had this same problem with other job application sites also.
    == URL of affected sites ==
    https://storefront.kenexa.com/lithia/cc/Home.ss

    There should be a User Agent Switcher menu item under Tools, which gives you the browser names you can impersonate.
    The menu item name changes to the browser UA you are presently using.
    There is also a User Agent Switcher button, you can add it using View -> Toolbars -> Customize, and dragging the button to your toolbar.
    See http://chrispederick.com/work/user-agent-switcher/features/ and http://chrispederick.com/work/user-agent-switcher/help/
    You can just start trying IE versions (or the versions it says on the site) until it lets you in.

  • Unable to load performance pack, using Java I/O on WL60, sp2

    Dear friends,
    I am seeking help from you. When we start WL60 SP2 on Sun Soloris 5.6, we got
    the following exception:
    <Jul 31, 2001 5:39:53 PM EDT> <Error> <Performance Pack> <Unable to load performance
    pack, using Java I/O.
    java.lang.UnsatisfiedLinkError: getFdLimit
    at weblogic.socket.PosixSocketMuxer.getFdLimit(Native Method)
    at weblogic.socket.PosixSocketMuxer.<init>(PosixSocketMuxer.java:104)
    at java.lang.Class.newInstance0(Native Method)
    at java.lang.Class.newInstance(Class.java:237)
    at weblogic.socket.SocketMuxer.makeTheMuxer(SocketMuxer.java:128)
    at weblogic.socket.SocketMuxer.getMuxer(SocketMuxer.java:83)
    at weblogic.t3.srvr.ListenThread.run(ListenThread.java:224)
    >
    Hoever, the server itself started, and our applications runs ok
    (at least so far). But this exception appears every time on some user accounts.
    I was wondering what causes this exception. Some user accounts in the same machine
    don't have this problem.
    I also wondering if it will cause performance problem when the traffic is high.
    We already applied the patches.
    Any hits and suggestions are welcome.
    Thanks in advance.
    -Ju

    Dear Deyan,
    Thanks for your help. We do have $WEBLOGIC_HOME/lib/solaris in LD_LIBRARY_PATH,
    which is set when running ". setEnv.sh" before startWebLogic.sh.
    We failed on one patch: 105210-27, for some reason.
    The strange thing is: in the same machine, all WL60 instances running under user
    accounts (under /users/developers/) have no such error. But it happens under some
    account, like accounts under /export/home/, etc. /user/developers is mounted on
    another physical machine.
    -Ju
    "Deyan D. Bektchiev" <[email protected]> wrote:
    >
    You should have the $WEBLOGIC_HOME/lib/solaris directory in your LD_LIBRARY_PATH
    so that
    the server can load the performance pack (which is a shared library called
    libmuxer.so).
    If it is present then do a ldd libmuzer.so and you will see if any libraries
    that it
    depends on are missing.
    Also make sure you have all of the requered patches for 2.6 installed.
    --dejan
    Ju Rao wrote:
    Dear friends,
    I am seeking help from you. When we start WL60 SP2 on Sun Soloris 5.6,we got
    the following exception:
    <Jul 31, 2001 5:39:53 PM EDT> <Error> <Performance Pack> <Unable toload performance
    pack, using Java I/O.
    java.lang.UnsatisfiedLinkError: getFdLimit
    at weblogic.socket.PosixSocketMuxer.getFdLimit(Native Method)
    at weblogic.socket.PosixSocketMuxer.<init>(PosixSocketMuxer.java:104)
    at java.lang.Class.newInstance0(Native Method)
    at java.lang.Class.newInstance(Class.java:237)
    at weblogic.socket.SocketMuxer.makeTheMuxer(SocketMuxer.java:128)
    at weblogic.socket.SocketMuxer.getMuxer(SocketMuxer.java:83)
    at weblogic.t3.srvr.ListenThread.run(ListenThread.java:224)
    >
    Hoever, the server itself started, and our applications runs ok
    (at least so far). But this exception appears every time on some useraccounts.
    I was wondering what causes this exception. Some user accounts in thesame machine
    don't have this problem.
    I also wondering if it will cause performance problem when the trafficis high.
    We already applied the patches.
    Any hits and suggestions are welcome.
    Thanks in advance.
    -JuContent-Description: Card for Deyan D. Bektchiev
    begin:vcard
    n:Bektchiev;Deyan
    tel;home:1-650-363-6055
    tel;work:1-650-289-1046
    x-mozilla-html:TRUE
    url:http://www.appl.net/
    org:Application Networks
    adr:;;444 Ramona St;Palo Alto;CA;94301;USA
    version:2.1
    email;internet:[email protected]
    fn:Deyan D. Bektchiev
    end:vcard

  • Query performance slow

    Hi Experts,
    Please clarify my doubts.
    1. How can we know the particular query performance slow in all?
    2. How can we define a cell in BEx?
    3. Info cube is info provider, Info Object is not Info Provider why?
    Thanks in advance

    Hi,
    1. How can we know the particular query performance slow in all?
       When you run the query it's take more time we know that query is taken more if where that query is taking more time you can collect the statics.
       like Selct your cube and set BI statics check box after that it will give the all statics data regarding your query.
      DB time (Data based time),Frent end Time (Query), Agrreation time like etc. based on that we go for the perfomance aggreations, compresion, indexes etc.
    2. How can we define a cell in BEx? 
       In Your Bex query your using two structures it's enabled. If you want create the different formulate by row wise you go for this.
    3. Info cube is info provider, Info Object is not Info Provider why?  
        Info object also info provider,
        when your info object also you can convert into info provider using " Convert as data target".
    Thanks and Regards,
    Venkat.
    Edited by: venkatewara reddy on Jul 27, 2011 12:05 PM

  • IMac OS X performing slow/hangs

    My iMac system is performing slower than expected and often hangs. I often wait up to a minute for the next action to happen, while the little cursor sits and spins. What to do? Frustrating.
    System specs that seem pertinent:
    4G memory (2 slots taken; 2 slots free)
    storage report says 176G free out of 499G
    OS X, 10.8.2
    Thanks, Apple community.

    Most often this indicates you are running to many applications concurrently for the amount of physical RAM you have installed. It may also mean you have a crashed process:
    Open Activity Monitor in the Utilities folder.  Select All Processes from the Processes dropdown menu.  Click twice on the CPU% column header to display in descending order.  If you find a process using a large amount of CPU time (>=70,) then select the process and click on the Quit icon in the toolbar.  Click on the Force Quit button to kill the process.  See if that helps.  Be sure to note the name of the runaway process so you can track down the cause of the problem.
    While Activity Monitor is open click on the System Memory tab in the bottom portion of the AM window. Use COMMAND-SHIFT-4, use the crosshairs to select this portion of the AM window, then use the Camera icon of this message composition window to post the image here.

  • Can anyone tell me the difference in performance between CSS URL switching

    first
    Can anyone tell me the difference in performance between CSS URL switching and F5 Big-IP?
    second
    Can anyone tell me the difference in performance between CSS URL switching and alteon ?
    third what is best overally?
    i think alteon is best
    is that right?
    best regard

    It looks like the primary question here is performance, in which case:Performance is not an issue, so long is it is sufficient. In the case of CSS 11000 and Alteon, performance fall within the same order of magnitude (supporting web sites with several billion hits per day.) F5 does not have sufficient performance, due to platform and OS limitations (I’ve heard as low as 50 connections per second in complex configurations). The Cisco CSM posts up over 10x the performance at 200k flows/second.
    Typically the primary concern is features, then CSS 11000 switches lead with a wide and flexible array of features that are not only helpful to network and web administrators, but well integrated too. CSS 11000 switches offer configuration through CLI, Web GUI, and XML. CSS 11000 collects statistics that can be exported to non-Cisco applications for billing and management.
    The CSS11000 also supports URL load balancing and HTTP header balancing within one content rule, with complex matching. Further, it supports user agent, pragma/no-cache, host field, cookie field, language field, accept, accept charset, accept-encoding, and Connection within the http header field.
    In addition, the CSS11000 matches up to 128 bytes with support of wildcards anywhere within the string.On the other hand, Nortel (Alteon) - HTTP header load balancing is not supported on the same VIP as URL load balancing. Eg. This means that a simulated WAP user cannot be directed to a server while load balancing "normal" browsers to their servers based on URL without using two separate VIPs. Only ONE http header load balance is supported on the entire switch. This limits you to either User Agent (WAP, Netscape, IE, Palm, etc), OR pragma/no cache (do not send the user to cache, allow (the user) to go to the origin), or Host field (allowing you to direct on domain name), or Cookie. Also, Nortel does not support the language field.
    In regards to F5, many of the performance claims are based on HTTP 1.0 requests (most web sites today are not using HTTP 1.0), Many emerging applications rely on HTTP 1.1 rather than HTTP 1.0. Also, the BIG-IP cannot spoof the connection to detect the URL, cannot do NAT on the flow, and cannot maintain states for persistent connections.
    Overall, I think CSS switches are the lowest cost to own, and most effective of all the load balancing platforms on the market.

  • Sending email using URL and URLConnection

    I have been having trouble trying to send an email using URL.
    I have specified the mail host using: mailHost = Options.getProperty("mailHost", "mail.myisp.com");
    and tried to send the email using this:
    try
    try
    URL u = new URL("mailto:"+recipient);
    URLConnection c = u.openConnection();
    c.setDoInput(true);
    c.setDoOutput(true);
    c.connect();
    PrintWriter out = new PrintWriter(new OutputStreamWriter(c.getOutputStream()));
    out.print("From:\"ME\" \n");
    out.print("Subject: Stuff \n");
    out.print("blah blah blah");
    out.close();
    catch etc. . .
    I recieve the email with the subject line there, but the actual body of the email is empty. Anyone know what I have done wrong? This is part of a standalone application that was turned into an .exe with jbuilder9.

    That worked, thanks!
    Out of curious, why the surprise that it worked?
    Its not that bad is it?Yeah, I didn't know that mailto: support was there either, is all. The blank line thing is just common in HTTP and sendmail so, I figured that would be the solution.
    I don't know that it's bad... if it works. Generally, the JavaMail APIs are a more robust way of sending mail, but if mailto: URLs work, and it's simple mail, then I see no reason not to use it.

  • PROBLEM while using URL in order to open a file from a servlet

    Hi,
    I am having a problem while trying to open a file from my servlet by using URL connection. Following is my code sample. what happens is when I first run my project it opens the file but after that when I rerun it again and again it sometimes opens it and sometimes not. if it can't open it it gives an error saying "the file is damaged and couldn't be repaired". I don't get any exceptions. if you guys can help me I will appreciate it so much... thanks.
    here is my code :
    URL url = new URL("http://demobcs.ibm.com:81/test.pdf");
    resp.setContentType(getContentType("http://demobcs.ibm.com:81/test.pdf"));
              ServletOutputStream sos = null;
              BufferedInputStream bis = null;
              try {
                   sos = resp.getOutputStream();
              } catch (Exception e) {
                   System.out.println("exception !!!!");
                   e.printStackTrace();
              System.out.println("burada2");
              try {
                   byte[] bytes = new byte[4096];
                   //bis = new BufferedInputStream(conn.getInputStream());
                   DataInputStream in = new DataInputStream(url.openStream());
                   //DataInputStream in = new DataInputStream(conn.getInputStream());
                   bis = new BufferedInputStream(in);
                   int j;
                   while ((j = bis.read(bytes, 0, 4096)) != -1) {
                        try {
                             sos.write(bytes, 0, 4096);
                             System.out.println("file is being read ...:");
                        } catch (Exception e) {
                             e.printStackTrace();
                   in.close();
                   bis.close();          
                   //sos.close();
              } catch (Exception e) {
                   System.out.println("exception :"+e.toString());
                   e.printStackTrace();
              }

    You are writing (<filesize> mod 4096) bytes of crap at the end of the file. Use your variable j instead for the number of bytes to write in your loop.

  • Open BI Publisher report  using URL View activity

    Hi,
    i need to call BI Publisher report and I want to use URL View activity (i followed instruction on http://oraclebizint.wordpress.com/2007/07/30/customizing-obi-ee-%e2%80%93-go-url-parameters/ but i can't have HTML Form inside af:form)
    But parameters on URL View activity are visible and i have to send username and pass..
    Is there another way?
    Tnx.
    Andreja

    Yes, I can put HTML form at top or bottom of page but i wanted to put in panelCollection (because of page design)....
    but I will think out something to look nicely too :)
    Tnx

  • About the performance of using shared variables

    Hi
     My system has almost 200 I/O points,I want to the host communicates with PLC using OPC(I had create a OPC I/O Server).
    If I use shared variables bind to OPC data items, there must be almost 200 shared variables.
    And my puzzle is that what's the performance of using these shared variables,will they eat up memory and processor?
    Another question is that if an shared variable will be time-lapse(i.e.,if an OPC data item value change feedback to  program block with 0 delay or not),if so ,then how many millseconds it will delaies? 

    here is a paper about the performance of shared variables.
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

  • Performance Report using OEM-11g

    Hi All,
    Is there any way to get the Monthly Database performance report using OEM Grid Control... I am able to grab only one week data in Historical option....
    Thanks In advance

    I have the same problem in OEM 11g, the calendar on the Performance tab - Historical selection - only shows "January 0" and can not be changed...a bug?
    Oracle 11.2.0.2.0 database on AIX.
    Using OEM Cloud 12c on some test instances again 11.2 on AIX and it works fine there.
    Any updates?

  • What are the limitations in terms of data size  or performance while using csv or text file as datasource?

    <p>Also what are the limitations in terms of data size  or performance related issues while using csv or text file?</p><p>Is it the best practice to use csv , text file to use as a datasource to improve performance?</p><p>Please Advice.... </p><p>&#160;</p>

    <p>Hi,</p><p>Create Same Data Input for CSV and Text File ,Create 2 different reports one for CSV and One for Text ,run them one you have done that.</p><p>Go to Report Menu and Select Performance Information .Use the Data in that to check which one is good datasource to improve performance</p><p>Cheers</p><p>Rahul</p>

  • Using URL Parameters in a PDF Form

    I built a form in LiveCycle Designer ES and I would like a couple of fields auto populated. The only way I could see doing this without having to purchase the LiveCycle Forms Server or another solution, is to embed the information in the URL.
    I found a blog post about it on Stefan Cameron's blog:  http://forms.stefcameron.com/2006/10/20/using-url-requests-in-pdf-forms/
    I was able to get this to work, but when I try to allow the user to save their form locally, the form information get cleared when they try to reopen it.
    I searched the NET and really couldn't find anything related to my problem.
    Does anyone have an idea about this or should I be looking at a different solution?
    Thanks,
    James

    I think that I was able to resolve this issue myself.  After opening the PDF with URL parameters, you need to manually enter data into a field before saving. After manually entering data in a field and saving, the form contains all of the data.

Maybe you are looking for

  • I have tryed to restore my i phone and it wont let me what do i do?

    I plugged my i phone 3gs into i tunes to restore it an it only got 3 quraters the way done an it stopped and now everytime you turn it on it comes up contect to i tunes, i done this again tonight and it has froze on a black screen with the apple sign

  • Why doesn't two-finger scrolling work for me with Yosemite?

    MacBook Pro from 2010, upgraded to Yosemite and now none of my two-finger scrolling works with the Trackpad. Doesn't work on any application - Chrome, Safari, Word, anything. It's super annoying. Tried messing around with Trackpad options in system p

  • Retina MacBook Pro 16GB or 8GB RAM

    Is 8 GB enough or I need 16 GB For: Parallels Desktop 8 (Win 8) - gaming and  C/C++/Java programming Final Cut Pro X - full HD video editing 60FPS Minecraft Server for 80-250 slots PhotoShop CS6 easy editing and logo design Music to the max! Movie do

  • Dual 867 PowerPC G4

    Primarily got this to run pro-tools but it cant handle it... I am running leopard Mac OS X 10.5.4 ... Now my question is this. If possible to upgrade my G4 how much can I upgrade the processors and would it be much more feasible to just get a G5 cost

  • Entry point not found -- sqlplus.exe

    Hi all, I was running oracle 9.2.0.1 on windows Xp. Today I upgraded it to 9.2.0.7 but after upgrade when I ran sqlplus, I was getting 9.2.0.1 as version. Since I had to upgrade the db to 10g so I installed 10g in new oracle home but after the instal