Slow read problem

Hi all,
I'm quite new in java and I have a question. I am trying to implement an simple Client-Server file transfer program. Everything works fine except that there is 1 small issue. It takes a long time to read the data from the data input stream. In my Client, I have the following code.
ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
DataInputStream dis = new DataInputStream(socket.getInputStream());
PrintStream os = new PrintStream(socket.getOutputStream());
// Do something
dis.ReadFully(buffer);  // This line took about 5.5 seconds average to finish executing.
                                //buffer size is about 64K bytes.
.I have timed the server sending data and the time it took was small. So I think the problem have to be the receiving side. I'm using 2 PCs networked together with a home router and LAN cables. One is the Server and one is the client. There is no software limiting upload and download speed. Is it because the DataInputStream is slow? Can someone tell me why it takes so long? If so, how to i improve it?
Thanks in advance.

ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());What's that for?
DataInputStream dis = new DataInputStream(socket.getInputStream());If you don't need the ObjectInputStream, delete it, and any ObjectOutputStream you may have at the other end. The ObjectInputStream is reading a header from the socket. which may be putting your application protocol out of sync, which might in turn explain your read delays. If you do need the ObjectInputStream, it extends DataInputStream so you don't need the DataInputStream.
PrintStream os = new PrintStream(socket.getOutputStream());Don't use PrintStreams or PrintWriters over a network. They absorb exceptions, and you need to know about those.

Similar Messages

  • Windows Server 2012 Storage Spaces Simple RAID 0 VERY SLOW reads, but fast writes with LSI 9207-8e SAS JBOD HBA Controller

    Has anyone else seen Windows Server 2012 Storage Spaces with a Simple RAID 0 (also happens with Mirrored RAID 1 and Parity RAID 5) virtual disk exhibiting extremely slow read speed of 5Mb/sec, yet write performance is normal at 650Mb/sec in RAID 0?
    Windows Server 2012 Standard
    Intel i7 CPU and Motherboard
    LSI 9207-8e 6Gb SAS JBOD Controller with latest firmware/BIOS and Windows driver.
    (4) Hitachi 4TB 6Gb SATA Enterprise Hard Disk Drives HUS724040ALE640
    (4) Hitachi 4TB 6Gb SATA Desktop Hard Disk Drives HDS724040ALE640
    Hitachi drives are directly connected to LSI 9207-8e using a 2-meter SAS SFF-8088 to eSATA cable to six-inch eSATA/SATA adapter.
    The Enterprise drives are on LSI's compatibility list.  The Desktop drives are not, but regardless, both drive models are affected by the problem.
    Interestingly, this entire configuration but with two SIIG eSATA 2-Port adapters instead of the LSI 9207-8e, works perfectly with both reads and writes at 670Mb/sec.
    I thought SAS was going to be a sure bet for expanding beyond the capacity of port limited eSATA adapters, but after a week of frustration and spending over $5,000.00 on drives, controllers and cabling, it's time to ask for help!
    Any similar experiences or solutions?

    Has anyone else seen Windows Server 2012 Storage Spaces with a Simple RAID 0 (also happens with Mirrored RAID 1 and Parity RAID 5) virtual disk exhibiting extremely slow read speed of 5Mb/sec, yet write performance is normal at 650Mb/sec in RAID 0?
    Windows Server 2012 Standard
    Intel i7 CPU and Motherboard
    LSI 9207-8e 6Gb SAS JBOD Controller with latest firmware/BIOS and Windows driver.
    (4) Hitachi 4TB 6Gb SATA Enterprise Hard Disk Drives HUS724040ALE640
    (4) Hitachi 4TB 6Gb SATA Desktop Hard Disk Drives HDS724040ALE640
    Hitachi drives are directly connected to LSI 9207-8e using a 2-meter SAS SFF-8088 to eSATA cable to six-inch eSATA/SATA adapter.
    The Enterprise drives are on LSI's compatibility list.  The Desktop drives are not, but regardless, both drive models are affected by the problem.
    Interestingly, this entire configuration but with two SIIG eSATA 2-Port adapters instead of the LSI 9207-8e, works perfectly with both reads and writes at 670Mb/sec.
    I thought SAS was going to be a sure bet for expanding beyond the capacity of port limited eSATA adapters, but after a week of frustration and spending over $5,000.00 on drives, controllers and cabling, it's time to ask for help!
    Any similar experiences or solutions?
    1) Yes, being slow either on reads or on writes is a quite common situation for storage spaces. See references (with some of the solutions I hope):
    http://social.technet.microsoft.com/Forums/en-US/winserverfiles/thread/a58f8fce-de45-4032-a3ef-f825ee39b96e/
    http://blogs.technet.com/b/askpfeplat/archive/2012/10/10/windows-server-2012-storage-spaces-is-it-for-you-could-be.aspx
    http://social.technet.microsoft.com/Forums/en-US/winserver8gen/thread/64aff15f-2e34-40c6-a873-2e0da5a355d2/
    and this one is my favorite putting a lot of light on the issue:
    http://helgeklein.com/blog/2012/03/windows-8-storage-spaces-bugs-and-design-flaws/
    2) Issues with SATA-to-SAS hardware is also very common. See:
    http://social.technet.microsoft.com/Forums/en-US/winserverClustering/thread/5d4f68b7-5fc4-4a3c-8232-a2a68bf3e6d2
    StarWind iSCSI SAN & NAS

  • [SOLVED] Slow read speeds from a DroboFS mounted in fstab via cifs

    I've decided to move all my media over to my drobofs which I have and I've mounted the share on the drobo in fstab this way:
    //mydrobofs/Media /media/drobofs cifs iocharset=utf8,uid=af,gid=users,guest,dir_mode=0775 0 0
    The share is mounted fine at boot but my issue is now the read speeds are very slow. opening a video file with vlc takes 30 seconds or more before it starts playing. Before this was accessing the share on my drobofs via the network tab (samba shares) in Dolphin (using KDE4) and here the video files played immediately in vlc (no delay). The reason why I want to mount the share via cifs and fstab is to move music collection over to the my drobofs and since I'm using Amarok for managing my collection this is the only way to make Amarok see my Music collection on the Drobofs.
    Why am I getting so slow read speeds with cifs?
    Last edited by fettouhi (2012-05-07 05:54:00)

    I did some more testing and seems like the problem has something to do with how many video files there are in the directory. I have some directories with several 100 video files and here I get this long delay but if I play a file that is in a directory by itself or only a few other video files are there, then the video starts immediately (almost). Is there a way to turn off this behaviour in vlc? Is it generating a playlist or what?

  • Weird Slow Connectivity Problem

    Hi guys
    We are facing a slow connection problem and we cant seem to find an answer
    as to whats happening.
    Our application has
    1. An app server hosting EJBs , datasources etc
    2. A webserver on different box hosting servlets and command classes.
    3.A Sql server 7 database on a different box.
    All these boxes are on a secured network ; which means that access to them
    is given on a requirement basis.
    We have JSPs on the web box which get a datasource connection from the app
    box to run queries against the database server.Our problem is that even to
    run a very simple query ; it takes a long long time (in order of minutes)
    and the same query runs lightening fast in the test environment where all
    the boxes are on the same network.
    We use type 4 SQL driver.We initially thought that this could be a network
    problem as it doesnt make sense that the same query runs very fast on the
    test boxes.But the network settings seem ok.
    The network settings are this way :
    Appserver box has access to database server box.
    Webserver box has access to Appserver box.
    So you can see that webserver doesnt have direct access to database
    server.Is it needed to run queries ; since I am taking a connection from the
    appserver.How does the whole business of running queries work when I take a
    connection from a datasource on an app server.
    I had this question posted to the BEA weblogic customer support ; but they
    really couldnt help me.
    Any ideas would be appreciated.
    Thanks
    Pankaj Vij

    This has many possible troubleshooting paths. You don't mention if this is a workgroup or domain based Windows network. Checking the "Directory Access" settings as appropriate may yield the solution.
    If this is a domain/active directory network the issue may lay with the machine account on the domain server.
    Create a new user account on the Mac and see if the problem follows when you log in to that account and try to access the SMB share.
    If the problem goes away, then you should look at the original user's startup items to see what might be launching at startup or simply move all files to the new user and delete the old account (not the preferred method).
    If the problem persists with a second user on the same machine, then I'd take another Mac, boot it to target disk mode (laptop is good for this), using a firewire cable, boot the troublesome mac to the target mac and try to replicate the issue.
    If issue persists, this is a network permissions issue on the server, if it goes away it is a local software issue on the Mac and a clean install of the OS may be needed if you can't locate the meddlesome settings/software.

  • Airdisk - SLOW read speed, but FAST write speed with Leopard 10.5.1?

    I've been complaining for a while about my random problems with reading files from airdisk. My solution has always been to relaunch finder and re-mount the airdisk when it slows down.
    I just noticed the speed cut down to and when looking at the activity monitor, it's fluctuating up and down and never seems to go past 1.5 to 2 MB/s.
    HOWEVER, what I did just notice is that my write speed is consistently 3-4 MB/s with no fluctuation at all. Interference is not an issue, as I'm on N-only mode and in 5GHZ.
    Is there anything I can do aside from waiting until 10.5.2? This does this issue in every AEBSn firmware. Thanks.

    I experience the same problem (slow read: 2,8 MB/s, fast write: 6,3 MB/s) with my airdisk over a LAN-connection with 10.5.2. I atteched the USB-drive directly to my iMac and then it's the other way around: fast write, slow read (although considerably higher and normal throughtputs so drive is OK).
    Anyone having some suggestions? The airdisk is formatted as HFS+ (GUID) with journalling on, Airport firmware 7.3.1 and the most recent updates installed.
    Message was edited by: jnmen

  • Slow component problem (logon page, login - logout)

    Hi All,
    since some time i'm experiencing a "slow component" problem with EP.
    As a sympthom portal is slow during first logon page and during login - logout.
    Jarm trace report the situation below:
    Component Name     Avg Gross Time (ms)     Total Gross Time (ms)     Max Gross Time (ms)
    UME:SAPJ2EEAuthenticator:getLoggedInUser     90,045     450,226     n/a
    AppServer:Security:Authentication:LOGIN:com.sap.security.core.server.jaas.SPNegoLoginModule     90,023     450,116     n/a
    AppServer:Security:Authentication:FastLoginContext:login     90,022     900,229     n/a
    AppServer:Security:Authentication:LOGIN:com.sun.security.auth.module.Krb5LoginModule     90,006     450,031     n/a
    (90 seconds to load login page!!)
    Seems to be an UME problem, but logs are OK and the configuration is the same of other systems that work fine.
    Anyone has any idea ?
    Thanks guru !
    Lorenzo

    Hi,
    I am dealing with exactly the same problem. I hope you should have fixed this problem by now. Please help me fix mine.
    Many thanks in advance.
    Regards,
    Pawan.

  • Fixing my slow sleep problem

    I have been having problems with my MacBook taking a fairly long time before going to sleep. In attempting to fix the problem I have tried repairing permissions, resetting PRAM, Safe Boot mode, cleaning the system with MacJanitor, etc. In some cases the system seem to work better, but eventually the slow sleep problem reappeared.
    I did further searching and found references to checking what the system was doing before going to sleep using the System Console. I tried this and found a variety of error messages being logged that didn't seem normal. With further investigation I found a number of problems related to remnants of old programs still affecting my system when they should have been removed some time ago.
    I started to track down and remove items manually such as no longer used prefpanes. I found items in the Launch Agents and Launch Daemons directories that shouldn't have been there. I even found an old kernel extension (SideTrack.kext) that was somehow transferred from my old Powerbook to my new MacBook. There were also .plist items hanging around that weren't needed - so I removed them too.
    After using the Console to identify problems in my system and then track down and remove all the old program remnants, my MacBook seems to be its old self again. It goes to sleep very quickly and the overall performance of the system seems improved. So, if you're having sleep issues or other problems I'd suggest having a look at the System Console to help identify the problems.

    The sleep time before the fix was in the 20-30 sec. range. The sleep time after getting things fixed is about 1-2 sec. or so.

  • Image reading problem in servlet

    Image reading problem in servlet
    I am reading an image in servlet and writing it to ServletOutputStream
    The following code works fine unless I change the size of the byte array (for increasing download speed) from 8 to something like 128 or any other higher value
    If I change the value of byte array size the image does not get downloaded properly, I mean the quality of the image changes, it does not looks like the original imageURL url = new URL("http://www.mysite.com/images/img1.jpg");
    URLConnection con = url.openConnection();
    con.setUseCaches(false);
    BufferedInputStream in = new BufferedInputStream(con.getInputStream());
    BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());
    byte b[] = new byte[8];
    while(in.read(b) != -1)
         out.write(b);
         out.flush();               
    out.close();
    in.close();what do I change
    byte array size
    or use the constructor of BufferedInputStream with 2 parameter
    or use the constructor of BufferedOutputStream with 2 parameter
    or use flush outside while loop or what else

    Change your while loop to:
    int count;
    while((count = in.read(b)) != -1)
         out.write(b, 0, count);
         out.flush();               
    }The penultimate time read is called, it may not fill the entire byte array. You only want to write out however much was read into the array.
    For better performance, you should move the flush() outside of the loop too. BufferedOutputStream will flush automatically when its internal buffer is full.

  • Telnet read problem -- Telnet read back

    I am trying to use telnet to send TL1 command to my UUT and expect to read back measurement data.  I was able to read proper data once in a while but most of the time I read back the TL1 command that I sent.  I tried different read mode and timeout period but nothing seem to matter.  My vi was written in Labview 8.2.1 with Internet toolkit.  I read in the forum about some limitation of the telnet read problem of the vi from the internet toolkit,  Is there any better read driver around?
    Thanks,
    Patrick 

    Hey!  I have a few questions for you that should help us solve this problem.  First, have you tried out the telnet shipping example "Telnet Line Client.vi".  This will help us minimize programming errors, etc.  Also, what type of device are you trying to communicate with?  Are there other forms of communication available?  For example, does the device also have a serial port, GPIB Port, etc.?  Also, is it possible to write to the device using TCP/IP (This is what telnet is based on)?  Let me know the answers to these questions and I will be better equipped to help you out!!
    Thanks!
    Dan
    Daniel Eaton
    National Instruments
    Systems Engineering
    Embedded and Industrial Control

  • T 420s cooling air coming out is very hot, finger print reader problem

    I am living in ruwais, abudhabi.i bought T 420s in last June from LENOVO  authorized distributor. Model number is 4174-KK4 and the sr no ***.
    Sometime the cooling air coming out is very hot, unable to keep the laptop on the lap.
    The cooling fan also replaced still the temperature is high.
    After replacing the fan I noticed that I noticed one of the screws was not fixed, I asked them to fix it, then they fixed it.
    I traveled back to my home 240 KM from the  authorized distributor service  center. when I started the laptop, the fingerprint reader was not working . Then I traveled back 240 KM to the  authorized distributor service  center to fix the issue. They fixed the fingerprint reader problem.
    Then now the SD card reader is not working. I was asked to bring the laptop to the  authorized distributor service centre.
    Can any one experience the same type of problems  with T 420s the cooling air coming out is very hot, finger print reader problem, card reader not working?
    The authorized distributor says for the service they can only cover 50 KM form the  authorized distributor service  center to the customer point, what is the conditions for the On site warranty ?. I am living 240 KM away from the authorized distributor service center from whom I bought the laptop.
    Moderator comment: Serial number(s) removed to protect member from mischief.

    Well clearly after the first incident. You need to check and us it verifying everything is working before leaving the service center or town its in. Go to a coffee shop and spend time using it and test each option is working.
    When the notebook its opened the finger print reader, card reader etc may not be connect properly or connectors not snap fully and disconnect. Mouse ultranav I have heard may also. But clearly you assume too much and you need to spend the time testing its working before leaving.
    These service center are only paid a fixed amount so they won't spend anymore time then they have to and address one problem you brought it in for.
    As for heat out put and over heating. There are many threads on these systems you can find and read about.
    Advice:
    - install Core Temp, this will monitor and display on the task bar you CPU core temp and you can see CPU load & Temperature at a glance if it approaching or staying near the max levels which will kill the CPU and/or motherboard due to cooking it. Its free just be sure to deselect any additional software from installing during the process. I use it on my notebooks. If the system is running high core Temp all the time you need to have it resolved or it will die and most likely out of warranty and/or your data will be lost if you don't have a backup as well. http://www.alcpu.com/CoreTemp/
    - use a laptop cooler. Its a flat pad you sit the laptop on you lap or table with usually two cooling fans that plug into the USB port for power. It will help cool the base of the laptop and other components inside will not be as hot. This will do nothing for the CPU temperature though.
    T520 Model 4239 Intel(R) Core(TM) i7-2860QM CPU @ 2.50GHz
    Intel Sandy Bridge & Nvidia NVS 4200M graphics Intel N 6300 Wi-Fi adapter
    Windows 7 Home Prem - 64bit w/8GB DDR3

  • I am unable to print documents.  States Adobe reader problem

    I cannot print documents as it says Adobe reader problem or error

    Windows 7; HP 2009m; printer is Lexmark S415;
    Message says
    Acro RD32.exe
    Adobe PDF document
    (There is a problem with Adobe Adrobat/Reader.  If it is running, please
    exit and try again. (15:3)

  • Slow internet problem on my iMac solved by installing Google Chrome browser

    Slow internet problem on my iMac solved by installing Google Chrome. My daughter came with her macbook pro loaded with OSX 10.6.8 but running Chrome and she could open all my problem websites instantly. So fault was in Safari. Thanks for all your help.  My original post has disappeared

    Original post is at:
    All of my pre 2012 macs extremely slow to load web pages but my son's 2014 mac and my iphone and ipad 2 load same sites instantly

  • DataSocket Read problem

    Hi all,
    When I use the new condensed "DataSocket Read" vi in Labview 6i (which is
    unfortunately not editable and is supposed to replace old vi's like "open
    connection", "update", "close" and so on) a single time to read automat
    words through an OPC server, the vi returns "zeros" all the way. The only
    solution I found to read the right datas is to place the "DataSocket Read"
    in a "While Loop" which loops until datas are different from zeros, which
    is very inconvenient and time consuming. I tried diffferent settings with
    "DataSocket Read" (wait for update, timeout) but the problem remains.
    Have you also faced the same problem ? Is there a solution ? Thanks for your
    assistance.
    Gaël RENEVIER
    Responsable Maintenance & Développement
    Tél : 04 74 82 20 08
    Fax : 04 74 82 24 92
    e-mail : [email protected]

    This is a problem with the 6i data socket routines ... use the old routines
    from the data socket examples (with the open,update, close drivers), and it
    works fine.
    Dave Gianetto
    http://www.gianetto.org
    > From: [email protected]
    > Organization: UUNET
    > Newsgroups: comp.lang.labview
    > Date: Tue, 21 Nov 2000 16:05:38 +0100
    > Subject: DataSocket Read problem
    >
    > Hi all,
    >
    > When I use the new condensed "DataSocket Read" vi in Labview 6i (which is
    > unfortunately not editable and is supposed to replace old vi's like "open
    > connection", "update", "close" and so on) a single time to read automat
    > words through an OPC server, the vi returns "zeros" all the way. The only
    > solution I found to read the right datas is to place the "DataSocket Read"
    > in a "W
    hile Loop" which loops until datas are different from zeros, which
    > is very inconvenient and time consuming. I tried diffferent settings with
    > "DataSocket Read" (wait for update, timeout) but the problem remains.
    >
    > Have you also faced the same problem ? Is there a solution ? Thanks for your
    > assistance.
    >
    >
    > Gaël RENEVIER
    > Responsable Maintenance & Développement
    > Tél : 04 74 82 20 08
    > Fax : 04 74 82 24 92
    > e-mail : [email protected]
    >
    >

  • Card Reader problem with MSI K8T Neo

    Hi,
    I have the K8T Neo motherboard, and every once and a while my Atech Flash 9 in 1 card reader  (http://www.newegg.com/app/ViewProductDesc.asp?description=20-176-003&depa=0) doesn't power up, thus I can't use it.
    What's odd is that all my other USB devices work flawlessly.
    The only way I'm able to use the card reader again is to power down my computer and then flip the power switch on the psu, then turn it back on, or unplug the reader from the usb header on the motherboard and plug it back in.
    I've noticed other people have had similar issues...
    Any ideas what causes this, or any ideas on how to fix this?
    Bio Haz

    Yes, I had the same hanging problems as well with older BIOS versions then 1.7.
    But that isn't the problem I'm talking about, the computer always starts up, it's just a matter if the usb reader will work or not.
    Maybe MSI has yet to make a BIOS that is compatible with all card readers.
    BioHaz
    Quote
    Originally posted by me_AMD
    ...yes, I had USB card reader problems but it caused the computer to hang during POST, and that was fixed with BIOS v1.7...
    ...I've had what you describe happen on another machine with a Mitsumi card reader/floppy drive combo...not sure what caused it...had to disconnect it and then plug it back in...???...

  • Hi, I recently came back from 3 months of not using my imac and found it to be exceedingly slow (a problem i have never had before (eg i cant get through playing a song on itunes without it pausing over 10 times for intervals of ~5 seconds.

    Please read subject first then continue with this text:
    Then I tried to connect my IPAD and IPHONE and neither would update because it couldnt find the file or something and then i couldnt even restore.
    The next day itunes was gone completely: "The iTunes application could not be opened. An unknown error occurred (13014)"
    dAnd then the next day ie today there is NO DOCK, NO BACKGROUND and NO DESKTOP ICONS! I had to open safari from the top bar that was only there because I have one random application called Garmin ANT that remained open (i never use this application, its a running computer watch thing)
    Thank you so much for any help you can provide
    PS Do i have a virus?
    I didnt think macs could get viruses?
    How do i back up my computer if i cant open finder?
    Thanks again
    PPS my computer is updated as far as i can tell and achieve.

    Please read this whole message before doing anything.
    This procedure is a diagnostic test. It’s unlikely to solve your problem. Don’t be disappointed when you find that nothing has changed after you complete it.
    The purpose of this exercise is to determine whether the problem is caused by third-party system modifications that load automatically at startup or login. Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards. Boot in safe mode and log in to the account with the problem. The instructions provided by Apple are as follows:
    Be sure your Mac is shut down.
    Press the power button.
    Immediately after you hear the startup tone, hold the Shift key. The Shift key should be held as soon as possible after the startup tone, but not before the tone.
    Release the Shift key when you see the gray Apple icon and the progress indicator (looks like a spinning gear).
    Safe mode is much slower to boot and run than normal, and some things won’t work at all, including wireless networking on certain Macs.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
    Test while in safe mode. Same problem(s)?
    After testing, reboot as usual (i.e., not in safe mode.)

Maybe you are looking for

  • N80 WiFi Upnp connection trouble

    Hi, Have setup N80 for WiFi and can use the internet through my linksys router. The problem is when I select gallery> home network> the waiting for devices just sits there. The PC's on the network cannot see the phone either any thoughts? Cheers

  • SD Number Ranges for Debit Memo

    Hi, We have maintained the number range 09 -9000000 to 9999999 for Invoice-cancel invoice-credit memo-debit memo in VOFA billing type. Now the client want to change the document number series for Debit memo alone as they are confused with the same se

  • ICal- Adding Alarm to calendar

    After making appointemnts and To Do lists in ICal, I want to set an alarm reminder. Although I follow all directions given through Support and Help, the alarm drop down menu is still gray. How can I add an alram?

  • DualCoreCenter Fails to work

    Sorry for such a Noob question but When I click the DualCoreCenter icon I get a brief hourglass mouse cursor then nothing...it seems to not execute.  I have the Dot Net framework installed..... Any ideas? Thanks

  • IPhoto 6.0.6 slide timer error after Quicktime export

    After a slideshow has been exported to Quicktime, the adjustment arrows for "Play this slide for x seconds" in the "Adjust This Slide" window are gone, and individual slide timing can no longer be adjusted for the slideshow. Anybody know how to fix t