Results 1 to 5 of 5

Thread: Huge Virtual Memory Size in a multi-connections client

  1. #1
    dscardaci is offline Registered User
    Name: Diego Scardaci
    Organization: TVBLOB SRL
    Project: routines to test an ICE backend system
    Join Date
    Nov 2008
    Posts
    3

    Huge Virtual Memory Size in a multi-connections client

    Hi,
    I'm developing a test-suite to test a backend component (the server in my scenario).
    My test-suite has to simulate a group of clients connecting to the backend. The backend component uses Glacier2.

    I work in Ubuntu environment on a 64 bit machine.

    To reach my target I developed the following steps:
    1) Create the communicator:
    ic= communicator();

    2) Get the default router
    router = Glacier2::RouterPrx::checkedCast( ic->getDefaultRouter() );

    then for each client:

    1) Create a new connection
    router = Glacier2::RouterPrx::uncheckedCast(rt->ice_connectionId(ide_router));

    2) Create a session
    base = router->createSession(serial, user);
    session = ade::argo::iGl2SessionPrx::uncheckedCast( base->ice_connectionId(ide_router)->ice_router(router) );

    3) Clients use the AMI interface to interact with the backend

    Examining the status of the machines I saw that the virtual memory used by my test-suite with about 15000 parallel connections is huge. In a test-case the virtual memory size is 235 GB after all the 15000 clients completed the connection, in another testcase the virtual memory size reach the 255 GB and the test crashes.

    Is this behavior normal?
    Is there a way to reduce the virtual memory size used by my test_suite?

    Thanks in advance for your help.

  2. #2
    benoit's Avatar
    benoit is offline ZeroC Staff
    Name: Benoit Foucher
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Rennes, France
    Posts
    2,196
    Hi Diego,

    Which Ice version do you use? I'll assume you use Ice 3.3.0. Establishing 15000 connections shouldn't require that much memory. However, I'm afraid it's difficult to figure out what could be wrong without more information.

    One possible reason for this memory usage is that your client sends more AMI requests than the server can handle and as a result the AMI request queue keeps growing eventually consuming a lot of memory. You should consider adding some flow control if this is the case (see here for more information).

    Another possible reason is that you create a communicator per connection/Glacier2 session and each communicator creates a number of threads that ends up consuming a lot of memory if you use the default thread stack size. If that's the case, you should consider using a single communicator instead.

    Cheers,
    Benoit.

  3. #3
    matthew's Avatar
    matthew is offline ZeroC Staff
    Name: Matthew Newhook
    Organization: ZeroC, Inc.
    Project: Internet Communications Engine
    Join Date
    Feb 2003
    Location
    NL, Canada
    Posts
    1,458
    I'll go a bit further, and say that lots of connections does not require lots of memory. During Ice 3.3 scalability testing, which I detailed in my blog post Glacier2 Scalability Improvements in Ice 3.3 - Matthew Newhook - ZeroC Blogs, I established over 8000 connections on a very old 32-bit Linux machine. The problem in the end wasn't memory, it was CPU. You must be doing something to eat all that memory in your application.

  4. #4
    dscardaci is offline Registered User
    Name: Diego Scardaci
    Organization: TVBLOB SRL
    Project: routines to test an ICE backend system
    Join Date
    Nov 2008
    Posts
    3
    Hello,
    thanks for your answers.

    I understood the problem. The huge virtual memory has been allocated by a big number of threads.
    In my test suite, I associated to each connection a class implementing IceUtil::TimerTask because I have to do some periodic operations. In this class I wrongly added a timer instance. Then, my test suite created a timer (and a thread) for each connection.
    I fixed the problem creating only one timer for all the connection.

    However, with only one timer I experienced another problem. In some tests, when the execution time of the operation involved is not short, the periodicity is not guaranteed.

    To solve this problem now I'm using a set of timers (for example one timer for each 100 connections) to try to guarantee the periodicity without consume all the memory.

    Do you think this is the correct way?

    Thanks in advance,
    Diego

  5. #5
    matthew's Avatar
    matthew is offline ZeroC Staff
    Name: Matthew Newhook
    Organization: ZeroC, Inc.
    Project: Internet Communications Engine
    Join Date
    Feb 2003
    Location
    NL, Canada
    Posts
    1,458
    I'm glad to hear you are making progress! I would think a better solution is to ensure that each timeout handler completes in a timely manner. For example, if the timeout handlers make remote invocations, you can ensure that by using AMI. If that isn't possible, then perhaps I would recommend adding a pool of threads behind the timer. Currently, however, that is not possible with our Timer class.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 15
    Last Post: 12-30-2009, 03:29 AM
  2. Multi IP address slow client connections.
    By Ian James in forum Help Center
    Replies: 1
    Last Post: 11-21-2007, 08:24 AM
  3. Replies: 3
    Last Post: 10-30-2007, 04:45 PM
  4. Replies: 1
    Last Post: 08-01-2006, 05:33 PM
  5. Replies: 2
    Last Post: 06-23-2005, 05:23 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
  •