Results 1 to 6 of 6
  1. #1
    ibtehal is offline Member
    Join Date
    Jun 2008
    Posts
    4
    Rep Power
    0

    Default inter process communication

    Hi,

    My code about generate requests simulation, I have to send 400 requests from client to server , I used TCP connection but in some times the server waite from client and the client also waite the response from the server ?
    should I use inter-process communication between client and server ,How can I implemnt this .

    for (int i=0;i<=400)
    {
    //send object to server

    thread.sleep(-1*Math.log(Math.random());

    //receive response object from the server

    }
    I have to generate my requests exponintially.

    Thanks:)

  2. #2
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    What's the problem?
    It unlikely that any single computer will handle 400 simultaneous network connections, do you expect them all to work at once?

    In general, its more reliable to queue requests in the main thread, and have one or more workers that do the actual network communications. The keeps one request from blocking all others.

    The Java concurrency modules have suitable tools to build this.

  3. #3
    ibtehal is offline Member
    Join Date
    Jun 2008
    Posts
    4
    Rep Power
    0

    Default

    Thank you very much

  4. #4
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Default local loopback

    If you are doing simulation, do it all in a program you write. You may be able to do 400 requests a second if the calling method and the responding method both reside locally on a machine you own and do not have any exposure to outside network.

    You may do a great deal of code testing if the server and the client are both written in the same program for the purpose of doing feasibility studies, ones you wrote yourself and run yourself.

    In fact, 4000 requests a second is not infeasible if you do not go to disk, use something from java.util that is classifiyable as Collections to simulate a collection of bytes on disk platter.

  5. #5
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    Nick is correct, but I tend to write such programs as two separate small pieces of code, then execute both on the same machine.

    Separate programs lets you do things like run several instances of the server code, so you can test the queuing system at assorted load levels

  6. #6
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Default simple server prototyping

    I cannot get Pat's response to show in the thread view but yes, we can code them as separated code units. I sortof had the design idea of a single static access method with some tricky but simple logic so that two threads are running and we have to deal with the synchronized and volatile and so on. That accomplishes several things. First,... we get off of other people's hardware and help departments. Second,... we have to work out the access logic and that brings a conceptual understanding of a process running full duplex ( something that is addressed in a grossly inadequate manner in the plethora of books commonly available ) and Thirdly,... we can now do feasiblity studies on how and if the app will scale when an if someone who knows nothing about techie trys to ship the app to a powerful server..,

    Pat, note that I cannot see your full counter-response while authoring this. We may have lost OP,... in which case we may direct poster to the server that ships with the sample code.

Similar Threads

  1. How to use pipes for inter-thread I/O
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-09-2008, 07:37 PM
  2. i need help in http process
    By sureshjava in forum New To Java
    Replies: 0
    Last Post: 01-29-2008, 05:56 AM
  3. Communication with c++
    By mathias in forum Advanced Java
    Replies: 1
    Last Post: 08-07-2007, 07:47 AM
  4. How can I set a time out on the loading process
    By paul in forum Advanced Java
    Replies: 1
    Last Post: 08-07-2007, 05:54 AM
  5. Linux process from java
    By Ed in forum New To Java
    Replies: 2
    Last Post: 07-04-2007, 06:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •