Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7592023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:48:05+00:00 2026-05-30T20:48:05+00:00

I have written a Java server for remote storage (an iSCSI Target). The client

  • 0

I have written a Java server for remote storage (an iSCSI Target). The client can write data by sending sequences of packets carrying the data payload. These packets consist of a fixed-length header (48 bytes) followed by a variable-length data segment. The length of data segment is specified in the header and can be considered fixed (8KiB).

Receiving a data packet is a two-part process. Firstly the header is read to a ByteBuffer with a size of 48 bytes. Immediately afterwards a second ByteBuffer is created via ByteBuffer.allocate(…). The size of this second buffer matches the data segment length specified in the header. Then the data segment is read into the second ByteBuffer using the SocketChannel.read(ByteBuffer) method. In the simple case this process works as expected – larger data segments and longer sequences increase IO speed. By “simple case” I mean that there is a single Thread which uses a blocking SocketChannel to receive (and process) packets. However if a second Thread with its own TCP connection and associated SocketChannel is added, the SockerChannel.read(ByteBuffer) execution times rise to more than 2.5ms, while the client server is sending 32KiB write commands (i.e. 4 consecutive data packets) on both connections. This is an increase by a factor of 8 to 10.

I would like to stress that at this stage the two Threads do not share any resources apart from the same network interface card. Each SocketChannel’s read buffer size is 43690 bytes (larger sizes didn’t have any effect on this phenomenon).

Any ideas what might be causing this or how this problem could be fixed?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T20:48:06+00:00Added an answer on May 30, 2026 at 8:48 pm

    … while the client server is sending 32KiB write commands (i.e. 4
    consecutive data packets) on both connections.

    Can you provide some details about the test setup? Is the client sending the packets serially to both connections? Then depending on the setup the increase could be client driven.

    Is it a localhost setup (client and server on one machine) or are client and server on different hosts? Have you tested both? Don’t trick yourself into seeing an execution time increase in a localhost setup especially if there is only one cpu and the test client also runs locally and maybe even single threaded.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

we have WebSphere MQ server. I have written Java client utility which can read
I have a client-server application written in Java using CORBA for the communication. The
I have written a java annotation that looks like this: @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.FIELD) // can
I have written a java client server application (not http), which i need to
I have a very simple client server code written java(server listens on some port
I have a server written in Java that runs as a Windows service (thanks
Hey all. I have a server written in java using the ServerSocket and Socket
I have a piece of server-ish software written in Java to run on Windows
I have something like a proxy server (written in java) running between my clients
I have several hand-written Java classes in a REST Server that uses JAXB to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.