Read/write mysteriously high flow in a pipeline, why?

Hello people,

I'm quite new to java programming. I'm trying to implement a pipeline procedure:
client connects to server socket and starts to send a file to the server on the basic package. In my case, I use the package of 64KB for sending file of 1 GB. After each packet to the client, the server stores the package to disk. Move Server to receive the next packet.

Server:

ServerSocket ss = (socketWriteTimeout > 0)?
ServerSocketChannel.open () t:System.NET.Sockets.Socket (): new ServerSocket();
Server.bind (ss, socAddr, 0);
ss.setReceiveBufferSize(128*1024);
Taking s = ss.accept ();
s.setTcpNoDelay (true);

In DataInputStream = new DataInputStream (new buffer (NetUtils.getInputStream (s), 512));

Then, for each packet of 64 k, I get and write to disk (specifically buffer for the core, unsynchronized)

long (EDT) 1 = System.currentTimeMillis ();

While (toRead > 0) {}
toRead-= in.read (buf.array (), buf.limit (), toRead);
}

long time2 = System.currentTimeMillis ();

File f = new File (fileName);
FileOutputStream out = new FileOutputStream (new RandomAccessFile(f,_"rw").getFD ())

long Time3 = System.currentTimeMillis ();

out. Write (buf, 0, BUFFER_SIZE);
out. Flush();

long years4 = System.currentTimeMillis ();
....

Client:

Socket s = new Socket (srv, port);
s.setSendBufferSize(128*1024);

DataOutputStream sockOut = new DataOutputStream)
new BufferedOutputStream (NetUtils.getOutputStream (s, writeTimeout),
512));

long worm = 0;
While (ver < 1024 * 1024 * 1024)
{

Then get a 64 k buf
sockOut.write (buf.array (), buf.position (), buf.remaining ());
Worm = buf.remaining ();
}
...

I have record receive time and disc for each packet writing time and accumulate on them at the end.
My machine is using 1 Gbps ethernet card, which gives me 102 MB/s speed n/w testable. My written disc rate is about 70 MB/s. I use Linux 2.6.31.
The interesting thing is that, for a 1 GB file that accumulation of setting time is only 4.6 seconds.

My guess is because I put the SO_RCVBUF, SO_SNDBUF, sockOut.write () of the client immediately returns when he wrote the package of 64 KB in the send buffer, then that server side, in.read () back at once when he read 64 KB of the receive buffer. So the actual transfer is made by someone else, not the write() or read() function. This guy sends data from client to server whenever the beef on each side is available.

My guess is just? Please advice.

Elton

But that triggers the transfer of actual data?

The kernel does when the data arrives in the receive buffer.

The socket transfer is initiated by the post () write(), each recorder gave in their SO_SNDBUF or SO_RCVBUF and the other have free space.

The transfer of socket is triggered on write whenever there is sending data in buffer management and the other end has to free space in its socket receive buffer. It is triggered receive every time he's given in the socket receive buffer.

And do you have any idea where can I find the details of the implementation like this?

Stevens, TCP/IP Illustrated volumes I, II and III.

I joined just extracted from code, not full version

More reason to shoot him.

I don't have your advice to not use BufferedOutputStream on socket. Why not?

Because you don't want no latency, as I said. But I would use on the file, so that you write-aligned block drive pieces of say 8192 bytes.

Tags: Java

Similar Questions

  • How to check the instance datafile I/O? solve the high physical reads/writes?

    Method-1
    identify 'hot spots' or I/O contention
    Select NAME,
    "Physical reads," PHYRDS
    round ((PHYRDS/PD.)) (PHYS_READS) * 100, 2) «Read %»,
    PHYWRTS "physical Scriptures."
    Round (PHYWRTS * 100/PD.) PHYS_WRTS, 2) "% of writing."
    FS. PHYBLKRD + FS. PHYBLKWRT "Total block I / O of.
    de)
    Select sum (PHYRDS) PHYS_READS,
    Sum (PHYWRTS) PHYS_WRTS
    v $ filestat
    ) pd,.
    v$ datafile df,.
    v$ filestat fs
    where df. FILE # = fs. FILE NO.
    ranking by fs. PHYBLKRD + fs. PHYBLKWRT / / desc


    Another method-
    On Oracle10g, CWA also provides the dba_hist_filestatxs table to track the disk i/o:

    break on begin_interval_time jump 2

    column phyrds 999 999 999 format
    column begin_interval_time format a25

    Select
    begin_interval_time,
    file name,
    phyrds
    Of
    dba_hist_filestatxs
    natural join
    dba_hist_snapshot;

    It is - method that you use to check for errors in data I/O file? AND how to solve high physical reads and writes?

    Ankit Ashok Aggarwal wrote:
    AWR project stat e/s in terms of segments, query and etc.
    Here, my concern is what should be the value of ideal threashold for a DBA to act on the high physical reads/writes?
    and how he can fix this problem if it affects database performance?

    I don't think that there is any possibility to mention that the amount of an e/s is going to be good or bad for a database in general. The reason is that it is not quantifiable. For example, in a store, maybe one day that no one gets and another day, there is no place to stand (because there was a sale announced by the store). So now, how do you say that it was not necessary? Rather than search for best practice values, it is best that you keep track of the normal functioning of your db and when you see a special summit in the values of events scattered user IO as DB file read, DB file parallel read etc and when this happens, you should check back the work you are doing and see if that can be refined somehow.

    Aman...

  • A better way to make a continuous read/write on a NOR-6008

    Hello

    I use a USB of NOR-6008 module and have a loop of the software configuration where I acquire analog signals, digital signals, then, then put a digital high or low and repeat. I use digital multiplex outside the material so that I can use 6 of the analog inputs to read 12 signals. The digital inputs that I have are connected to the buttons on a panel that are used for the entry instead of the screen of the computer of the user. My loop is also to build a buffer zone of all the signals on the analog and digital lines that I read in so I can on average and this process elsewhere in the program.

    The question that I am running is because this loop is very slow and on the final product is performed on a touch screen, XP Embedded PC and just this acquisition loop begins again as much CPU as the rest of my program. I would say that drops of loops on 4 or 5 cycles per second, which means that my update of 2 multiplex signals or longer than a second time. I would really like to better performance and does not use as much of my CPU resources.

    I use a way simple enough to make the loop of the acquisition, by setting the parameters I, reading, deleting the task, defining the parameters DI, read, erase the task and then by setting the parameters, write about it and delete the task, which gives a slight delay and repeat.

    Any thoughts on a better way to start the read/write that what I'm doing?

    I have attached the code examples in the loop of the acquisition that I use.

    Thank you!

    First of all, the best plan is to move the chain DAQmx before the loop to create and use a start DAQmx, then write in the loop, then clear once the loop ends.  This configuration must be done once, not every time you write the channel.  This should speed things up considerably.

  • Synchronization with Serial read/write problems. can not get the functionality of the terminal emulator

    Hello

    I am writing a VI to control PWM with a microcontroller via a serial port. I wrote a simple code for the microcontroller that allows me to set the ratio of duty cycle on a scale of 0-65535. It works very well with Termite of Compuphase (RS-232 plug); The microcontroller invited me to an entry, expected that I would one, updates and expected another entry when I decided to send him. Now, I'm trying to get the same functionality on a LabVIEW vi but hit a snag.

    When I tried to send my orders with a series read base and an example of writing, everything worked fine. I could see the prompt entry, write an entry and if I was quick enough, check out the update message. Even when I was not fast enough, I was able to check the update by monitoring the PWM pin with a Logic Analyzer. The problem with the basic example, however, is that I need to update the report to aura cyclical ratio, so I went for an example of reading continues writing. The problem I've met; is that I have to switch between reading and writing to make it work. When I do that, either I don't hold write it down long enough and nothing happens, or I get several updates when I switch to reading. Some of these updates don't even match and produce updates to defective upgrades for example; 16000 16000, 16000, 16000, 6000, 600, 60, 16000, 1600, 60, 0, 0, 0, 16000, 60, 0, 0 etc.

    I tried which allows characters of endpoint in the hope that the writing would end at the end and go to reading where he would receive a termination character and wait for me allow writing once again, but nothing helped. I still have to alternate between the two and either get no response on reading several updates of variable accuracy. I tried to remove her allows read/write and their structures of matter in the hope that the loop flow, associated with the characters of endpoint would the case, but then the updates don't register at all. The funny thing is I did a VI like this before with an Arduino and that there not even no need to switch between writing and reading (I'm now using a Board of Freescale FRDM).

    I was also the frequency of timeout errors; Error-1073807339 at VISA Read, reason Possible: VISA Hex 0xBFFF0015. I removed the option to stop the while loop if there is an error so I can run but always pops up an error on the judgment occasionally. Could the problem of synchronization always cause me problems?

    Would appreciate all advice really, I am providing my slightly modified example screws and can provide the code for microcontroller on request, even if it's very simple.

    Thanks in advance, it is
    Yusif Nurizade

    In other words, frankly, a good bad example you according to your code. Also, you have the order of writing and read upside down in your amendment if the instrument requires a command to return something. It should really be using a structure of the event. The structure of the event around a write and read and use a value change event. I have attached a quick change. This mod is still a reading after writing. If necessary, you may have two separate events to write and read.

  • a speed of read/write DAQ card mode change will reach 200K

    HEY, man,

    I have a project needs to test two points I name them point A and point B, the first time, I should point A 5V DC input, voltage inductive test point B, sencodly, give point B 5V DC input and inductive point test output voltage, this means and two analog ports must read and write sharing mode , and the test speed must be 100 KB, if I have a 200 KB data acquisition card, can the speed of read/write mode change reach 100 KB for an analog port? or, please give your suggest for my this kind of situation, thank you.

    Hi API,.

    I see that you are trying to measure voltages using a single channel at a time on a data acquisition card.

    Unfortunately, you cannot change the inputs to the outputs or vice versa on a map of data acquisition, they are static.

    What I recommend is either using a switch like this: http://sine.ni.com/nips/cds/view/p/lang/en/nid/207130 where you will need a high chassis.

    Or, having four channels, 2 inputs and 2 outputs and try to measure it. You should have the necessary speed as well.

    If you have any other questions, I'd be happy to answer.

    Thank you very much

  • Frequency of calls to control for the FPGA read/write

    Hello

    I use a cRIO-9076 with a module NI 9476 DO spend some faucets. It is sometimes necessary for faucets with a pulse time down to a few ms of impulse.

    The FPGA VI Gets the power tap queries, executes a logic of security, and routes the numerical results for the exits. It gets applications power of the VI on RT target that uses the function ' Read/write FPGA control' interaction programming of the FPGA VI front. The loop on the RT runs with 1 kHz, no iteration is missed. That means, it should be possible to switch the valves with a resolution of 1 ms.

    What I see on an oscilloscope, is that the output digital are high for multiples of 50 ms, the system does not reach the valve for example 80 ms pulse or pulses shorter than Ms. 50 is a kind of limitation for calls of "FPGA read/write control"? I tried both options for arbitration, but it does not help.

    The best knowledge of the limiting cRIO/module/features or ideas? Thank you in advance.

    Karsten

    Hi Karsten

    You use any time in your FPGA VI?

    It is useful to your code by sending as an attachment so that I can have a look.

    Kind regards

  • Sony ILÇE-7R - what is the speed of read/write in the camera

    I have several Sony ILÇE-7R cameras used for a given application where more than 80 panes in a row with 1 second interval occur.

    When you are taking pictures on a 1 sec shutter time / 1.2 s, then the camera tends to slow when writing the buffer on the SD card. (A suitable high-speed sdcard has been used).  When the buffer is disabled on the SD card, then the camera accepts no any command of the shutter (IR Led or cable gives the same question), so I'm missing components/images.

    What is the read/write speed in the camera?

    What are the compensation of buffer time?

    Are there settings that can improve the buffer time on the SD card, while taking still pictures of compensation?

    Is there firmware settings that have been implemented to improve the write speed camera?

    Thank you very much

    Kind regards


  • Help? the source volume is read-write and can not be disassembled...

    I use 10.11.5 on an iMac 21.5 ", end of 2009 and I want to restore the OS X 10.11.5 to HD on an external drive but I get this message" Source volume is read = write and cannot be disassembled, so it cannot be copied from block. "  I can find answers do not address El Capitan.  Help would be greatly appreciated.

    .. .Goldie

    You use disk utility's restore feature?

    If the HD has a recovery partition, you can make starting in place of the recovery.

    Or you can use SuperDuper! (the basic version is free and can copy the entire disk, the paid version allows "smart updates", which copies only files that are different, saving time) running on externally to perform the copy.

  • Tecra A8 DVD don't read/write DVD-R 1-16 x.

    Using Sonic Record DLA, Tecra A8 DVD don't read/write DVD-R 1-16 x. Ok work on DVD - R 1-8 x and CD DVD - R 1-16 x has tested successfully on the two recent Toshiba Satellite Pro and HP Office. Have updated the Bios, software DVD-RAM and Sonic DLA.

    Hey,.

    What exactly do you mean? This means that you can t burn DVD-r with 16 x speed?
    In this case, you should check the specifications of your CD/DVD drive. Not all models support this speed of combustion. In addition, I recommend using 8 x only, he speed will give you a better quality of the burned data/average.

    You must also use different types of media. I believe that your other computers have different drives in order to test different mediums. I have a good experience with Verbatim DVD-R.

  • DVD recorder is not read/write discs DVD-RAM on Satellite A200-1GH

    Hello!!

    I have the problem as the topic - my DVD drive is not read/write DVD-RAM discs (recorder: HL-DT-ST DVDRAM GSA-T20N). Unfortunately, there is no any drivers (more recent than I've got) for this recorder on the Toshiba, not even site on LG or Microsoft. What should I do?

    Greetings

    Hello

    To be honest, it's quite strange. If the laptop is preinstalled with recovery image, it should work. I tested it on my laptop 5 minutes ago and it works. The DVD-RAM disc is readable and different documents can be saved on the disk too.

    Do you use your own installation of OS, or you still have some factory settings?

  • Carpet * a UJ-830 cannot read/write DVDs on Equium L10

    Hi, I have a laptop Equium L10. My DVD RAM mast * a UJ 830 cannot read/write to DVD discs. But it can read and write CDs.
    I have installed the latest driver but no luck. Any suggestion will be appreciated.

    This problem appears since day one?

    I ask because it looks like a hardware malfunction, to me it seems that the lens can not calibrate properly and that's why the drive can read and write DVDs.
    What burning software do you use?
    For the most part a burning like Nero program provides an error message if the burning process failed

  • Enter a share with read rights and have read/write rights

    I have a folder with my photos on my Mac. In this folder, I have all my photos in subfolders and will add new pictures once I created the share. I want to make them accessible to my family there own PC/Mac. But only with READ ONLY. My problem is that a user (account to share on my Mac) with reading rights can access my shared with read/write rights.

    I have my Mac with 10.11.2 the following users/groups:

    • (Jens) My Admin account
    • (Erika) Account sharing
    • (Family) A group

    Group of members of the family are:

    • Jens
    • Erika

    My folder permissions to "/ Volumes/ExtHD/Bilder" are:

    • Family: read
    • Jens: Read/write
    • everyone: read

    I enabled file sharing in the system settings and the 'Pictures' folder added to the share list.

    Now I go to another Mac with Yosemite, go to network in the Finder, select the computer with the share, connect to the "Erika" and open the folder "pictures". I can generate records or files, delete files, so I have read/write rights. Why?

    Finder don't show me no option 'Erika' should have rights to write to this folder. Why is she able to delete files?

    If get you information on the drive, it is the checkbox ignore verified property?

    What is the format of the disc?

  • Control of read/write of FPGA Interface

    I need help on control of FPGA read/write Interface. I would like to connect data TCP Read (String) directly to VI FPGA Read, but the entrance is an FXP... How can I do this?

    Then change your FPGA control to be a byte (U8).  On the side of your host, use the array of strings of bytes, then Index Array to get the specific byte you want to write on the FPGA.

  • How to read/write tdms 2.0 files with the TDM C DLL?

    Hello

    How to read/write tdms 2.0 files with the TDM C DLL?

    How consequently the datas in interlaced with the TDM C DLL mode?

    Thank you

    Confirmation: TDM C DLL always wrote the file in TDMS version 2.0.

  • How to add more variables to a read/write control?

    See how the read/write control is connected to global variables? I want to add more variables, I created the globals (some are listed in the table above), but as you can see that they are not available in the read/write control. How can I add them? I also tried to create a new read/write control, but as you can see that didn't help.

    Any help would be appreciated.

    Hi count3r5tr1ke,

    It seems that you are referencing a particular bitfile in open FPGA reference. I think that even when you save your FPGA VI, VI real time still referencing an older bitfile. Have you tried re - compile and referring to the new bitfile once finished compiling? A sure way to make sure that you have the most up-to-date bitfile is to check the VI option when you right-click on the FPGA Open reference and select Configure the reference open FPGA. When this option is checked, if you make changes to the FPGA code, it will force you to re - compile the FPGA VI before you reference it on the real-time side.

    Best regards,

Maybe you are looking for

  • Firefox mobile Firefox 9 10

    I'm moving my profile of 9 Firefox on a win xp machine to a win machine with Firefox 10 7. I changed a number of profiles of Ff since xp machines to xp, but I can't get this problem is resolved. Any help will be greatly appreciated. Thank you. Richar

  • HP Envy 8 5000 Note: can I change HP Envy 8 note 5000 network card?

  • HP 550-a17c: hp 550 - a17 customers

    Can anyone tell me about the HP 550-a17c desktop computer, as is a good PC a have comments on it or someone has this PC, how does it work like any infor. that everyone has on this, thank you.

  • OpenCom restores material

    Hello I have a perculiar problem. I have a test configuration and I would like to communicate via RS232. I'm contacting an Arduino, ATMega (which could be part of the problem...) using a USB cable and RS232 Protocol at 19200 baud. I use COM12 (not th

  • HP Laserjet Pro M125a: LaserJet M125a is not printing with Windows XP SP3

    Hello world.Today I bought the new printer. I tried to install this printer on my old pc with Win xp, but the installation pops up the window with warning "software for this device:"printer "has not passed the test with windows xp compatibility syste