Sunday, September 25, 2005

Java Message Service

The application-to-application messaging systems, when used in business system, are generically referred to as MOM. Message-Oriented-Middleware provides a common reliable way for programs to create, send, receive and read messages in any distributed Enterprise System. MOM ensures fast, reliable asynchronous electronic communication, guaranteed message delivery, receipt notification and transaction control. MOM (Message Oriented Middleware) provides:

  • Fault tolerance

  • Load balancing, scalability

  • Transactional support
for enterprises that need to reliably exchange large quantities of messages.

The Java Message Service (JMS) provides a standard Java-based interface to the message services of a MOM of some other provider. JMS is an API for enterprise messaging created by Sun. JMS is not a messaging system itself; it's an abstraction of the interfaces and classes needed by messaging clients.

JMS provides standard API for enterprise messaging. Just like JDBC for standard database connection. You can use SonicMQ or IBM MQseries as underline messaging mechanism.

Enterprise Messaging delivers message async. It can be configed as persistent or transient. Persistent can guarantee deliver once and only once. Transient delivers at most once.    
Messaging systems are classified into different models that determine which client receives a message. The most common messaging models are:
Publish-Subscribe MessagingPoint-To-Point MessagingRequest-Reply Messaging Not all MOM providers support all these models.

Friday, July 29, 2005

Leak by Apache aspdotnet module


It turns out to be Apache aspdotnet mod bug

This is a bug reported from Apache site:
We are doing production testing with our application, Oracle ODP.NET, and
mod_aspdotnet and noticed memory leaks occuring within the Apache process with
mod_aspdotnet installed. Our application does not leak with IIS or the Casini
web server. The objects which are not GC'd are those requiring finalization. I
examined the running process with WinDBG and SOS and found that the finalizer
thread in the application domain was stalled waiting on on a event sync for
one of the application STA model threads. I have made a test change in
mod_aspdotnet.cpp which converts the application threads from STA to MTA and
the problem seems to go away. Here is the code change (2 places):
Old:
// Check that THIS thread is coinitialized.
HRESULT hr = CoInitialize(NULL);
if (hr == RPC_E_CHANGED_MODE)
hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);


New:
// Check that THIS thread is coinitialized.
HRESULT hr = CoInitializeEx(NULL,COINIT_MULTITHREADED);
// if (hr == RPC_E_CHANGED_MODE)
// hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);

After making this changed, I verified that all threads are MTA and that the
finalizer is not stalled. I have run several high throughput tests with our
application hitting both the 2.0 mod_aspdotnet and my modified module and the
modified module does not leak managed objects over 24 hour periods.

Friday, July 22, 2005

.NET memory leak




Tried to fix .NET (C#) memory leak.

Our software architecture is based on Apache, Tomecat, .NET remoting and .NET framework.

I used purifyplus from IBM (Rational) to profile our codes and found out the behavior for garbage collector of .NET platform is strange, it does not perform garbage collection until I force it to do so.

From the above observation, I decided to call GC.collect() in one of the thread in the program every 15 secs. It seems to be helpful. ( but why??)

I also fixed the DBConcurrencyException which could causes leak when it happens. DBConcurrencyException is thrown by the ADO.NET codes when the database data is out of sync with the memory version.

Also see:
http://www.c-sharpcorner.com/Code/2002/Aug/GCinNet.asp

http://www.codeproject.com/dotnet/garbagecollection.asp

http://www.developer.com/net/csharp/article.php/3343191

http://blogs.msdn.com/stevenpr/archive/2004/07/26/197254.aspx

http://memprofiler.com/


----------