#15 implement in C#

closed
nobody
None
5
2014-08-18
2004-05-20
Qin DeBu
No

Hi
The attachment is that I implement SimpleWeb in C#,
I am new to C#,just learned it in a few weeks.So this
Implemention is dirty and Simple,not Clear.But It Can
Work.
You can download .net framework and run csc *.cs

Qin DeBu

Discussion

  • Qin DeBu
    Qin DeBu
    2004-05-20

     
    Attachments
  • Logged In: NO

    Hi,

    This could be pretty cool. I had intended to begin a c#
    implementation of Simple but havent had the time. By the way
    is the source contained within the .rar file or is this like
    a .jar with just the .class files?

    Niall

     
  • Logged In: NO

    Yes,it contained the source.

    I am currently working on the design.
    I had finded that the server is not quick response to client's
    refresh.I think there is some way to avoid this.

    To improve the performace,we can send daba to client with
    the non-blocking socket.I think this is the best way.

     
  • Qin DeBu
    Qin DeBu
    2004-06-17

    Logged In: YES
    user_id=1045781

    Hi

    I test the SimpleWeb using Qaload.
    P4 2.6
    DDR 1G
    Windows2000 server
    JDK1.4

    After More than 400 Simultaneous Users ,
    A mass of the errors ("unable to connect to server")
    arise.It is because that the server is too busy, so
    the thread which accepts the connection havn't no
    cup time.I has no proper mothed to solve the problem,
    unfortunatly.Can you help me?

    Regards

     
  • Logged In: NO

    Hi

    Simple can never get overloaded, it uses a vector to store
    Sockets and a prioritizing mechanism to poll Sockets from
    that vector.The only limitation is the number of file
    descriptors the operating system will allow and the amount
    of memory allocated to the JVM.

    In my opinion your problem is caused by either,

    1) A small connection backlog for the ServerSocket
    2) The activity of the connected sockets
    3) The number of file descriptors allowed by Windows 2000

    It is most likely (1) so I recommend that you set the
    backlog to a higher amound in the ServerSocket and also
    spawn several connection threads as follows.

    ServerSocket sock = new ServerSocket(80);
    Connection.connect(sock); // one thread
    Connection.connect(sock); // two threads
    Connection.connect(sock); // three threads

    P.S Let me know if this solved your problem.

    Niall

     
  • Logged In: NO

    Hi

    A higher amound in the ServerSocket cann't solve the
    problem.

    I had tyied to set the ServerSocket's Thread as the
    maximum priority,and controlled the processor which dequeue
    pollers from the PulseSckeduler.The SimpleWeb achieved the
    higher throughput and the error is avoided.

    P.S the attachment is the modified source file

    thanks
    Qin debu

     
  • Qin DeBu
    Qin DeBu
    2004-06-20

     
    Attachments
  • Qin DeBu
    Qin DeBu
    2004-06-20

     
    Attachments
  • Logged In: NO

    Hi,

    I see now what your problem is. To achieve a similar result
    without modifying the source you can set the polling maximum
    interval to a higher count, which will mean that polling is
    less intrusive. Try

    ProtocolHandler h = // ...
    PipelineHandler p = PipelineHandlerFactory(h, 5, 5000);
    Connection c = ConnectionFactory.getConnection(p);

    This will half the number of pollers and increase the CPU
    cycles spent on polling inactive connections.

    Niall

     
  • Qin DeBu
    Qin DeBu
    2004-06-22

    Logged In: YES
    user_id=1045781

    Hi

    Sorry,I cann't express myself exactly in english.

    I had tried it,and tested again.Error ratio is sharp down
    actually, but not good enough yet.If i set the ServerSocket's
    thread as the maximum priority,the error is avoided
    completely.Will this modification result in blight?

    Thanks
    Qin debu

     
  • Qin DeBu
    Qin DeBu
    2004-06-22

    Logged In: YES
    user_id=1045781

    Hi

    Sorry,I cann't express myself exactly in english.

    I had tried it,and tested again.Error ratio is sharp down
    actually, but not good enough yet.If i set the ServerSocket's
    thread as the maximum priority,the error is avoided
    completely.Will this modification result in blight?

    Thanks
    Qin debu

     
    • status: open --> closed