473,696 Members | 2,127 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Fast Multiple Application Comunication

This post is realy to get some opinions on the best way of getting fast
comunication between multiple applications. I have scowered the web for
imformation on this subject and have just found conflicting views and
far from ideal solutions.

My application has to send small amounts of data about 50bytes to
multiple client applications. The catch is that this has to happen
about 1000 times a second.

My first attempt was .net remotting which I have to say worked very
well. After I developed a host of helper classes to get around such
problems as events it works fine and seems to work. However it is no
where near fast enough and as you start to reach the desired refresh
rate the CPU races the memory usage goes through the roof and the
entire system keels over.

So I have reached the conclusion that remoting is not going to provide
me with the answer. That leaves me with a question, what else? Here is
a list of the candidates I have found to date:

1. Named Pipes
2. Custom Remotting Sink
3. Mutex
4. TCP Socket

Unfortunatly all these solutions seem to have problems. A named pipe is
not part of the .net framework and does not seem to support message
notification very well. I am not even sure if a custom romting Sink
will actually improve things. Again Mutex's are not inherant in the
..net framework; they are not object orientated and are highly
discouraged by Microsoft. A TCP Socket would require allot of work to
construct wrappers and comunications layers, I want an easy life.

So I would apreciate comments on the best method to achieve high
performance and fast inter application comunication. I should say that
primarily I am concerned with applications running on the same machine
and idealy it would be asynchronous.

May 12 '06 #1
11 4339
1000 times per second? Easy life? I don't think they're compatible!

Named pipes are best and you'll almost certainly find a wrapper for them at
pinvoke.net. Failing that, I would look at UDP rather than TCP. It's very
easy to do using System.Net.Sock ets and UdpClient object.

Steve
May 12 '06 #2
You seem to have left out shared memory which would be the fastest solution
if you are running on the same machine. Here is a simple wrapper that may
help you out a bit http://addressof.com/blog/archive/2003/05/01/164.aspx

Another solution that you have left out is using a shared file for
communications which can also be extremely fast (I had no issue pushing
10k/second through this mechanism). Generally the way to do this is to use a
checkpointing mechanism, then just seek within the filestream. I have an old
example I could probably pull out if you are interested in going this route
....

I am not sure what you are talking about in dealign with the mutex below,
mutexes are implemented in the .net framework but they are not used for
pushing data from one app to another, they are used for synchronization ?
Also there is nothing that says they are bad to use; they are quite often
used to synchronize processes, they are just not generally used within the
same process space as Monitor provides the same functionality with better
performance and without the overhead of the OS resource.

Cheers,

Greg Young
MVP - C#
"Olie" <ow****@gmail.c om> wrote in message
news:11******** *************@g 10g2000cwb.goog legroups.com...
This post is realy to get some opinions on the best way of getting fast
comunication between multiple applications. I have scowered the web for
imformation on this subject and have just found conflicting views and
far from ideal solutions.

My application has to send small amounts of data about 50bytes to
multiple client applications. The catch is that this has to happen
about 1000 times a second.

My first attempt was .net remotting which I have to say worked very
well. After I developed a host of helper classes to get around such
problems as events it works fine and seems to work. However it is no
where near fast enough and as you start to reach the desired refresh
rate the CPU races the memory usage goes through the roof and the
entire system keels over.

So I have reached the conclusion that remoting is not going to provide
me with the answer. That leaves me with a question, what else? Here is
a list of the candidates I have found to date:

1. Named Pipes
2. Custom Remotting Sink
3. Mutex
4. TCP Socket

Unfortunatly all these solutions seem to have problems. A named pipe is
not part of the .net framework and does not seem to support message
notification very well. I am not even sure if a custom romting Sink
will actually improve things. Again Mutex's are not inherant in the
.net framework; they are not object orientated and are highly
discouraged by Microsoft. A TCP Socket would require allot of work to
construct wrappers and comunications layers, I want an easy life.

So I would apreciate comments on the best method to achieve high
performance and fast inter application comunication. I should say that
primarily I am concerned with applications running on the same machine
and idealy it would be asynchronous.

May 12 '06 #3
Mind to add the number of client applications to your requirements, this
figure is important has I guess whatever IPC mechanims you use, you will peg
the CPU, unless you are willing to invest into multi-cpu boxes. Anothor
question is; are you pushing 1000 * 50 byte messages to each separate
client, or are you simply broadcasting?

Willy.
"Olie" <ow****@gmail.c om> wrote in message
news:11******** *************@g 10g2000cwb.goog legroups.com...
| This post is realy to get some opinions on the best way of getting fast
| comunication between multiple applications. I have scowered the web for
| imformation on this subject and have just found conflicting views and
| far from ideal solutions.
|
| My application has to send small amounts of data about 50bytes to
| multiple client applications. The catch is that this has to happen
| about 1000 times a second.
|
| My first attempt was .net remotting which I have to say worked very
| well. After I developed a host of helper classes to get around such
| problems as events it works fine and seems to work. However it is no
| where near fast enough and as you start to reach the desired refresh
| rate the CPU races the memory usage goes through the roof and the
| entire system keels over.
|
| So I have reached the conclusion that remoting is not going to provide
| me with the answer. That leaves me with a question, what else? Here is
| a list of the candidates I have found to date:
|
| 1. Named Pipes
| 2. Custom Remotting Sink
| 3. Mutex
| 4. TCP Socket
|
| Unfortunatly all these solutions seem to have problems. A named pipe is
| not part of the .net framework and does not seem to support message
| notification very well. I am not even sure if a custom romting Sink
| will actually improve things. Again Mutex's are not inherant in the
| .net framework; they are not object orientated and are highly
| discouraged by Microsoft. A TCP Socket would require allot of work to
| construct wrappers and comunications layers, I want an easy life.
|
| So I would apreciate comments on the best method to achieve high
| performance and fast inter application comunication. I should say that
| primarily I am concerned with applications running on the same machine
| and idealy it would be asynchronous.
|
May 12 '06 #4
Yes that is a good point about the number of clients. The requirement
is for up to 20 clients which is relatively small. A broadcast method
would be fine but I do need to ensure that any message gets to all the
clients.

Correct me if I am wrong Greg but I do not believe that I did leave out
Shared Memory or Shared Files as I think Shared Mutex is a lower level
abstraction on Shared Memory and Pipes is an implementation of Shared
Files. I should have maybe elaborated on the Mutex a bit more (cause of
much confusion and I do not profess to have got it correct). Yes .net
does support mutex's for thread synchronisation but this is a different
kind of implementation I believe it only allows access within the
application domain. Another kind of mutex can be used to access the
same object from many applications but I have not found a way to do
this in the .net framework. This is how Shared Memory works it creates
a named mutex of memory that can be accessed from many applications. I
think the reason that shared mutexs are not generally recomended is
that there is no guarantee that the mutex you are connecting has the
same structure.

Thanks Steve, I was definately leaning towards Named Pipes I just
wanted to see if there was a solution to be found that is built into
the .net framework. I am slightly confused that Micrsoft did not think
of the need for fast comunication when developing the framework.

May 12 '06 #5
Yes .net
does support mutex's for thread synchronisation but this is a different
kind of implementation I believe it only allows access within the
application domain. Another kind of mutex can be used to access the
same object from many applications but I have not found a way to do
this in the .net framework. This is how Shared Memory works it creates
a named mutex of memory that can be accessed from many applications. I
think the reason that shared mutexs are not generally recomended is
that there is no guarantee that the mutex you are connecting has the
same structure.
Your assumptions on mutex are incorrect.

A mutex is an OS level locking mechanism ... nothing more ... It is
generally used to synchronize seperate processes. Think of it like a Monitor
(i.e. lock() { }) that can be used through multiple applications.

A mutex is used to synchronize access to global resources (like a shared
file or shared memory). It does not contain any real storage itself.

As for not having the "same sata structure", a mutex will always be a mutex,
this issue may apply to the shared resource but the same issue would apply
to any shared resource (I can easily connect a mail client to a server it
doesn't understand how to deal with and it will not work very well).

Cheers,

Greg Young
MVP - C#
"Olie" <ow****@gmail.c om> wrote in message
news:11******** **************@ i39g2000cwa.goo glegroups.com.. . Yes that is a good point about the number of clients. The requirement
is for up to 20 clients which is relatively small. A broadcast method
would be fine but I do need to ensure that any message gets to all the
clients.

Correct me if I am wrong Greg but I do not believe that I did leave out
Shared Memory or Shared Files as I think Shared Mutex is a lower level
abstraction on Shared Memory and Pipes is an implementation of Shared
Files. I should have maybe elaborated on the Mutex a bit more (cause of
much confusion and I do not profess to have got it correct). Yes .net
does support mutex's for thread synchronisation but this is a different
kind of implementation I believe it only allows access within the
application domain. Another kind of mutex can be used to access the
same object from many applications but I have not found a way to do
this in the .net framework. This is how Shared Memory works it creates
a named mutex of memory that can be accessed from many applications. I
think the reason that shared mutexs are not generally recomended is
that there is no guarantee that the mutex you are connecting has the
same structure.

Thanks Steve, I was definately leaning towards Named Pipes I just
wanted to see if there was a solution to be found that is built into
the .net framework. I am slightly confused that Micrsoft did not think
of the need for fast comunication when developing the framework.

May 12 '06 #6
I should add that shared resources such as shared memory and files while
fast are best used on the same machine .. if there are machine boundaries
then you are better off with something like UDP and MSNs (message sequence
numbers)
"Olie" <ow****@gmail.c om> wrote in message
news:11******** **************@ i39g2000cwa.goo glegroups.com.. .
Yes that is a good point about the number of clients. The requirement
is for up to 20 clients which is relatively small. A broadcast method
would be fine but I do need to ensure that any message gets to all the
clients.

Correct me if I am wrong Greg but I do not believe that I did leave out
Shared Memory or Shared Files as I think Shared Mutex is a lower level
abstraction on Shared Memory and Pipes is an implementation of Shared
Files. I should have maybe elaborated on the Mutex a bit more (cause of
much confusion and I do not profess to have got it correct). Yes .net
does support mutex's for thread synchronisation but this is a different
kind of implementation I believe it only allows access within the
application domain. Another kind of mutex can be used to access the
same object from many applications but I have not found a way to do
this in the .net framework. This is how Shared Memory works it creates
a named mutex of memory that can be accessed from many applications. I
think the reason that shared mutexs are not generally recomended is
that there is no guarantee that the mutex you are connecting has the
same structure.

Thanks Steve, I was definately leaning towards Named Pipes I just
wanted to see if there was a solution to be found that is built into
the .net framework. I am slightly confused that Micrsoft did not think
of the need for fast comunication when developing the framework.

May 12 '06 #7
"Olie" <ow****@gmail.c om> wrote:
Another kind of mutex can be used to access the
same object from many applications but I have not found a way to do
this in the .net framework. This is how Shared Memory works it creates
a named mutex of memory that can be accessed from many applications.


A named mutex is still exactly that, a synchronization object for
ensuring MUTual EXclusion. Named mutexes are used for inter-process
synchronization . To use shared memory or shared files for inter-process
communication requires synchronization , so that other applications know
when the memory has been updated, and when it is being modified so that
they will not attempt concurrent updates. Mutexes can fill this role,
but mutexes do not represent shared memory.

-- Barry
May 12 '06 #8
I just wanted to correct myself as I have discovered that there is a
way in the .net framework to use named pipes although this is new to
version 2. If you use an IpcChannel then it will use named pipes as the
method of transfering the serialized objects. This does give you a huge
performance benefit over Tcp channels but will obviously work only on
the local machine.

May 15 '06 #9

"Olie" <ow****@gmail.c om> wrote in message
news:11******** **************@ i40g2000cwc.goo glegroups.com.. .
|I just wanted to correct myself as I have discovered that there is a
| way in the .net framework to use named pipes although this is new to
| version 2. If you use an IpcChannel then it will use named pipes as the
| method of transfering the serialized objects. This does give you a huge
| performance benefit over Tcp channels but will obviously work only on
| the local machine.
|

Be carefull, I would not call it a 'huge' performance benefit, the benefit
depends largely on the size of the messages passed.
There is a clear benefit over tcp when dealing with small messages, when
passing large messages though, tcp is the clear winner.

Willy.

May 15 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2932
by: Zunbeltz Izaola | last post by:
Hi, I have the following problem. I'm developing a GUI program (wxPython). This program has to comunicate (TCP) whit other program that controls a laboratory machine to do a measurement. I have a dialog box, wiht two buttoms "Start measurement" and "Stop". "Start" executes a function that do the measurement in the following way.
0
1628
by: SoftComplete Development | last post by:
AlphaTIX is a powerful, fast, scalable and easy to use Full Text Indexing and Retrieval library that will completely satisfy your application's indexing and retrieval needs. AlphaTIX indexing technology provides you with highest indexing performance, possibility to index very large sets of data in minimal time even with memory constraints and unbelievable fast query processing speed. The main AlphaTIX's feature that makes it first and...
5
1865
by: Maarten | last post by:
Hi all, I' facing a problem here that i am stucked with since i started with.net in vb6.0 i used for example Form1.txtName.text = "test" in vb.net i used DirectCast(Me.MdiParent, Form1).txtName.text = "test" and in C# i use ? i have a settingsform where users can make changes of in and output's
11
2169
by: gregory_may | last post by:
I am developing an application that I would like to distribute on CD. Norton blows it up very badly. Is there some API I can talk to let Norton know I am ok?
0
1088
by: zunbeltz | last post by:
Hi, I'am writing a program to cotrol a machine. I use socket comunication (TCP) to do it. I do a measurement in my machine like this: def DoMeasurement(): setup1() setup2() while MeasurementNotFinished():
5
15099
by: Rotzooi | last post by:
Hi, In the past I created a VB6 application that was capable of accepting multiple client connections for status logging over the internet using simple non-Windows clients (GSM/GPRS). There is one management console/monitor that receives messages and keeps track of keep-alive polling. The monitor created a new WinSock connection for each client that logged on. These were put into an array of controls. I'm sure this can also be done with...
2
2404
by: Steve | last post by:
I have a FileSystemWatcher watching a directory where I will add and update files. When it detects a change, I search through all the files and update my list of files in the UI. This works fine. Now, my other application that is writing the files that are being watched, does something like this: 1) Creates a file, a.txt 2) wants to name it b.txt but checks first if b.txt exists, if it does, it delete it 3) moves a.txt to b.txt...
2
6479
by: findyasir | last post by:
Hi all, I am having problem comunication with serial port in linux. I have tested the serial port with attaching a serial modem and dialing the numbers with wvdial. it works okie but when i connect HSM to the serial port it sends the message but i did not get a reply. mean it always being blocked in the read function. The same hsm is working fine in unix. so there is no problem with hsm. I am using the code as given
2
3359
by: vhm | last post by:
Hi all, I have to debug a hardware that comunicate with the computer through a USB conection. I know that the harware present some problem when the driver send some type of command to it. I'll like to discover what command is causing the hardware to crash. How can I intercept the comunication via USB between this hardware and the PC and record it to a file, for this to be analized later? Someone have writen a program to do that? Can someone give...
0
8661
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8595
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
9008
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...
1
8875
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8849
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
7699
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
6512
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...
1
3030
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
1989
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.