Bursting the library

An interesting feature of Push Framework is its ability to profile itself and send a real time report to a remote Dashboard where the numbers are drawn into usable display. For more on this feature and how to activate it, please refer to :

In this article we test this feature against the previously developed chat server.  To make the server busy, a Multi-client Simulator is developed. The behavior of chat participant is modeled by the Bot class. The bot will login, randomly chat with other participants, randomly join and send room chats.

As you might have noticed, the source code of the chat client program was split into two projects (excluding the TCPSocket and XMLProtocol DLLs) :

  • ChatClient (The Client UI program)
  • ChatAPI

All interaction withj remote chat server was encapsulated into a simple-to-use ChatAPI class. We beneficiate from this by deriving our Bot class from the ChatAPI class.

Here are some small excepts of code, the details are left to those who would like to download the source code :
Eatch Bot run on a separate thread. Network IO is done asynchronously, so the thread is able to give control each 1 s to a virtual function call where acustom operations can be defined :

void Bot::onPerformAutomatedJob()
{
	if (!isLogged)
		return;
 
	static int nSecs = 0;
	nSecs++;
 
	if (nSecs % roomChatFreq ==  0)
	{
		SendChatToJoinedRoom();
	}
	if (nSecs % directChatFreq == 0)
	{
		SendChatToRandomClient();
	}
 
	if (nSecs % joinRoomFreq == 0)
	{
		JoinRandomRoom();
	}
 
	/*
	if (getLoggedTime() > 100)
		{
			Logout();
		}*/
 
}

Server responses are ctahced into member function :

  void Bot::OnDirectChat( std::string sender, std::string msg )
{
	if (rand() % 100  > directChatSinking)
	{
		std::string str = "hi " + sender + " i received ur msg";
		SendDirectChat(sender, str);
	}
}

Now we tell Push Framework to profile itself and accept connections from remote Dashboard :

        server.enableRemoteMonitor(2012, "open semsem!");
	server.enableProfiling(10);

Now we launch the Dashboard, login and expect real time report each 10 seconds.

The Flex Permission server is listening on port1010. The test is done here on the same machine.  100 clients are started by the simulator and we can see this information on visitors tab of the Dashboard:

The bandwidth tab shows the volume of data exchanged

Bandwidth per connection in details (both outband and inband). Vertical length is the dispersion. Center of segment is the average value :

The following figure reports the fill rate and sending rate of all broadcasting channels. The time axis uses an opposite direction (Feature is under work, you can see that from the color palette). What explains the great values seen on the send rate of  “signals” broadcasting channels is the fact that at first the server broadcasts the presence information for all participant : each particpants receives the list of others.

The Performance tabs shows reports about the incoming requests and processing time :

Processing Time in details :

Share
Create PDF    Send article as PDF