473,624 Members | 2,005 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Object pooling in Socket Connection to increase throughput

22 New Member
Object SharingOn a Windows 2000 (XP etc.) platform, it is possible to ‘share’ the Component Enabler client object (the LINCEnvironment object) among users. This can be achieved by making use of the COM+ features of the platform itself.
Setting up is easy

The LINCEnvironment object can be made into a COM+ object, simply by declaring it as such using the Component Services console from the control panel. A wizard lets you choose the LINCEnvironment object from a list, after which it does the rest. Then, in the properties of the new COM+ object, you can turn on object pooling, and set minimum and maximum values for the pool.

Using it is easy
When creating a LINCEnvironment object in your client, the system will automatically return you one from the pool, rather than creating a new one.
To release the object, you simply need to clear any reference to it by your client. When the system detects that there are no more references to the object, it is automatically returned to the pool, ready for the next client to use.

Is there a catch?
On its own, this technique requires stateless Ispecs, as all users are in essence sharing the one EAE session, transaction number, and so on.
Stateful sessions, however, are possible in combination with Message Queuing.

Message Queuing.To avoid one TCP/IP socket connection per user, EAE Release 3.2 adds a Microsoft Message Queuing (MSMQ) transport.
With message queuing all requests are wrapped as messages and placed on a message queue. The Remote Access Servers (RAS) then read all user requests from the queue, using one (or more) TCP/IP socket(s). The request is then unwrapped, and passed to the EAE system to process.
While one request is being processed by the EAE system, RAS is available to read another message and pass it on to the EAE system. In this way we can achieve a higher throughput with just one connection.
When the EAE host has processed a request, the reply is picked up by RAS and sent back to the user’s reply queue (identified in the original message). RAS is then free to process more requests and replies while the client processes its reply.
If the connection nears saturation, it is possible to start another RAS process and connection to read from the request queue, thus doubling the potential throughput.
There’s more!
In addition to the reduction of TCP/IP socket connections, message queuing has also allowed us to store a ‘state key’ within the message infrastructure. This state key is used by the EAE system to restore the ‘state’ of the session for a particular user, to what it was at the end of the last reply.
Using this, the client can pass the state key with the next request, and know that EAE will restore the state as it was in the previous transaction. This means that items like GLB.WORK will work as it this were a normal terminal session.
Look in the Component Enabler class reference for the new methods that allow your client to get and set the state key.
And even more!
While message queuing can reduce the number of TCP/IP socket connections, in of itself, it still requires one LINCEnvironment object per user. However, in conjunction with object pooling described above, it is simple to share the LINCEnvironment objects amongst the clients, while still maintaining a stateful system.

SubclassingSubclassing is a technique in object-orientated languages, which allows you to expand upon, or change the behavior of the parent object.
What this means to you, is that it is possible to add new functions, or change functions of the LINCEnvironment class to work in the way you want.
This is best explained with an example. Using subclassing, it is simple to change the behavior of the LINCEnvironment object, such that it will automatically connect itself to your EAE host when you create the object. This can simplify your clients significantly. Such functionality would also be very useful where you may wish to make your system available to several parties, but do not wish them to know the details of how to connect.
If you wished all spaces to be replaced with   for web access, you could simply write a method to do the substitution for you. This would be of most advantage when using a scripting client, as Java will run much faster as it is in essence, compiled.
Is this a component?
With subclassing, you can also move in the direction of making your EAE system appear as components. For instance, a single method call in your subclass could connect to the system, navigate to a particular Ispec, and then gather data from multiple Ispecs, before returning the data to the client. From the client perspective, it was all achieved with a single invocation of a component. The actual mechanics of the call can be completely hidden from the client programmer.
Why stop at one?Each subclass can be given a different name, and individually registered as a COM (and even COM+) object. This allows you to create a series of components, all of which perform a different function. To the client programmer however, they simply appear as different components.

Pooling As individual components, they can also be pooled individually. As pooled objects, they might only connect once, thus removing the connect and login overhead for subsequent clients.
Note that a subclassed, pooled object communicating via message queuing can be a very efficient (albeit more complex) solution to large numbers of WWW users.
Dec 19 '11 #1
0 3504

Sign in to post your reply or Sign up for a free account.

Similar topics

4
17687
by: Fuzzyman | last post by:
In a nutshell - the question I'm asking is, how do I make a socket conenction go via a proxy server ? All our internet traffic has to go through a proxy-server at location 'dav-serv:8080' and I need to make a socket connection through it. The reason (with code example) is as follows : I am hacking "Tiny HTTP Proxy" by SUZUKI Hisao to make an http proxy that modifies URLs. I haven't got very far - having started from zero knowledge of...
7
1834
by: Walter Zydhek | last post by:
Which would be less resource instensive and faster? A "hosted" remoting class or a class set up with object pooling via Component Services? -Walt Zydhek
0
1410
by: Tom Stepka | last post by:
Problem: We are experiencing an excessive (i.e. 16 - 20 seconds) delay when attempting to establish socket connection over the network, using the TcpLister.AcceptSocket() and TcpClient.Connect(ipAddress, Port) calls. It seems that the delay is between client.Connect() and listener.Accept(). We never have a delay when we use a telnet client to connect to the server. And we do not have a delay on all networks, just on some. The code we...
0
1303
by: Paul | last post by:
I'm trying to use a socket connection from within an asp.net application. It works, but somehow opening the socket seems to be extremely slow. It finally connects and you can transfer information, but it hangs for at least 5 seconds before the connection completes. Interestingly, a second connection to the same port in a very short time interval (<1s) returns instantly, but if you wait for a couple of seconds a new connection again takes...
0
1665
by: Gene | last post by:
Hello, I've created a simple webservice (one method) and a simple test program- instantiating a proxy-object and calling the method. Everything works fine. (I am running the webservice and test program on the same machine). I use the SysInternals TCPView utility and see that when the test program calls the web-service, a connection is ESTABLISHED and LISTENING. However- after the call is complete, this state persists. I then added a...
6
3542
by: Sharon | last post by:
Hi all. I'm trying first time async socket connection. In all the examples i've seen, the server connection is closed when the message is complete. Is it common to close the connection after every message? Also, the message is complete, meaning there is no more data to read, only when the client closes the connection. My solution is to keep the connection open, and send a terminator / eof at the end of every message. Is it the right...
1
2722
by: Ismail Demiralp | last post by:
Hi, I want to open a permanent socket connection to a service witch is running on the same computer. After I logged in on my php page, I start a session. After this a socket connection should be opened to a service I get data from. Now my problem is I want open only once a socket connection to the service and after this I want use on all php pages this connection. How can I transmit (or use) this one connection on all pages ?
5
15712
by: Arno | last post by:
reposted with the right microsoft managed newsgroup ID: Sorry for the inconvinience Hi, I've written a class for client-socket connection, but I get a lot of times the error message "Unable to read data from the transport connection" when restart reading the stream with socket.BeginRead in the Sub SocketIncomingMsg. I'm debugging now for weeks, but I can't detect where it's
0
1835
by: T1Stuff | last post by:
I have programmed a simple synchronous socket server app in vb.net to communicate and receive messages from our data integration tool that works well with all our other systems. The program I built works with as many messages as I can send accross as long as they are sent one after another (queued). However once any length of time passes, the server app doesn't receive any data as if the listener doesnt have the connection any more. I...
0
2641
by: ryaneoghan | last post by:
hi, I was just wondering if anyone could help, i am trying to create a client and server socket connection in perl, i want to ask for name and then do a check on the name and ask for a secret word if it does not match, i have this much done but dont know where to go from here and cant find anything to help on net, if you could help using the code i have done i would be grateful, thanks! here is the 2 files #!/usr/bin/perl -w #...
0
8173
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8679
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8621
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8475
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7159
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6110
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4079
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4174
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1785
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.