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 7749749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:07:01+00:00 2026-06-01T11:07:01+00:00

I have a chat application(Socket Programming) , for that consider I have 2 separate

  • 0

I have a chat application(Socket Programming) , for that consider I have 2 separate chat servers ‘Server1’ & ‘Server2’ .
I am using 2 chat servers to for load balancing(Lvs). My LVS is working fine.

For example: When 1000 users at a time tries to login , with the effect of LVS, 500 requests goes to ‘server1’ and other 500 to ‘server2’.

Here comes my problem: When I am trying to login for 5000 users , after around 4850 successful login, I am getting error :

Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: unable to create new native thread

on ‘Client side’.

How should I deal with this?

For reference: i am using newfixedthreadpool ,
Here is part of login that I am using on server side and client side.

On server side:

ExecutorService executorService = Executors.newFixedThreadPool(400);
while(true){
    s = ss.accept(); 
}

On login side

for(int i=startc;i<endc;i++) // here for e.g if we want to login 1000 users, startc value =1 and endc value=1000.
    {
        ChatClient.chatHandler  = new ChatClient("users"+i);
    }

ChatClient {

public ChatClient(String username)
    {
        Chatclient = this;
        this.username = username;   
        LoginChatConnect();
    }
}

void LoginchatConnect(){
try{
    sockChatListen  = new Socket(URLstore.serverSocket,URLstore.ChatPort); // chatPort=5004,serverSocket=server Ip address.
}catch (IOException e) {
            System.out.println("IOException in LoginChat "+e);
        }
}

Any suggestions will be helpful.

  • 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-06-01T11:07:03+00:00Added an answer on June 1, 2026 at 11:07 am

    I think what are you trying to do is, you are testing your server application i.e. chat server by running test application i.e. client . now you must be running that particular code in loop . this loop of yours giving you outofmemory exception, which is obvious. if you will keep on running code in infinite loop its bound to go outofmemory.

    i will suggest to run the loop in finite for loop like run it for 4000 times on one client machine and you can run multiple test code on many client machines. run the test client on different machine for example each client running loop for 4000 times and such clients you are running on 4 different machines. so output will be, your client test code will not fail because of outofmemory exception and you will be able to test your server application for 16k user logins..

    it should work

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

Sidebar

Related Questions

I have try to make chat application with socket programing and I am using
Using Socket.IO's WebSocket I have successfully managed a chat application from my home computer
I have written a Chat application using C#. The project is a separate Windows
I have a small application that I am building a Chat application into, so
I have been working on on an AJAX chat application using php, mysql. It's
I am creating a chat application using JApplet . I have a TextArea where
I am writing a Sivlerlight Chat application using Sockets and the DataContractSerializer. I have
I have chat server application which we are going to deploy on 3 servers.
I have created a chat application using PHP, but it works only into my
I have created simple chat application using smack api.i can able to chat well.but

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.