" /> Project Anvil: October 2006 Archives

« September 2006 | Main | February 2007 »

October 20, 2006

Scaling Anvil for larger organizations

So as we were going through some changes with Anvil at the code level, one of the things I had to do was implement CryptoCard's latest COM object. They merged some of their old code into a single source, which is a really nice idea.

One problem that I quickly came across stumped out progress, and pretty bad. Our web service is written in a manner that uses a multi-threaded apartment model (MTA). That makes sense since we could have hundreds of concurrent authentication requests (especially first thing in the morning when everyone is logging in). However the COM object was written in a single-threaded apartment model (STA). Not a major problem for simple applications as you can use the [STAThread] directive to make the app work single threaded, our use ASP.NETs model that can STA itself. Big problem in a web service, where you CAN'T do that. And even though there is a work around presented in MSDN Magazine, it would mean I would be loading the COM library for each thread...which could easily get to 500MB to a GIG of memory usage when an organization first logs in at 9 in the morning.

So, I went to CryptoCard and expressed my performance problem with the COM object. And then did an AWESOME job address my problem. They rewrote their COM library to support MTA, and did it in just a few days! Thanks guys.

So now, instead of taking 500 MB of memory during a major load for authentication, it is taking around 5 to 10 MB. Talk about sweet! And now, this web service can really scale. With TestComplete's load testing and performance profiling, I can really put it through its paces. And Anvil keeps going strong. Man I love it when a plan comes together. :)