How to convert a DTED (Elevation) File to a Raster

Multi-Threading with C# and a Website

23. November 2011 00:40 by Scott in Development, C#  //  Tags: , , ,   //   Comments (6)

Let me tell you my experience.

I have a website at http://www.utopiapimp.com that gets hit well over 1 Million times a day.  Thats 11 hits every Second.  Utopiapimp works on being a Live Stock Ticker for a online game called Utopia.  My users need live feeds 24/7 of whats happening in the game and thats what my application does for it.  Live feeds 24/7 for all users.  Its extremely dynamic as well.  Always changing, always updating.

My server that hosts my website is a VPS located with the company Ultima Hosts.  I have a middle tiered plan that costs a bit to host.  The advertising on Pimp pays for the hosting fees, but it doesn’t cover any more than that.  I have 4 GBs of Ram and 1 CPU.  I store so much in the caching system, that I take and use up at times almost all 4 GBs of Ram.  The problem mainly is the CPU.  At times the CPU hits 80% used and other times it coasts around 15% used.  So I was hoping to bring in some multi threading into Pimp to make the inserts into the DB much faster and a much faster response time for the users.

I started with just one thread, the new type of tasking in C# introduced in .Net 4.0.

Task.Factory.StartNew(() => DoSomeWork());

The Problem with this I think, is I only have one CPU.  When I implemented this method, I sadly and immediately saw a block.  The application started to hang.  I spent the next few weeks to try and stop the hang.  Yes, sadly, I introduced a bug so bad, I immediately started getting user connections loss.  I introduced a ton of code when I introduced this bug, so I was completely lost on the topic.  I thought well, it had to be something else.  Not until I wrapped the task around my error handling code to insert errors into the DB, did I realize what was going on. So I tried threading instead.

System.Threading.Thread newThread = new System.Threading.Thread(anObject.AMethod);
newThread.Start();

This didn’t work either.  I then realized, well maybe threads just don’t work on .Net Web apps.  I then thought, well maybe its just my 1 CPU.  Well, I haven’t yet upgraded to the second CPU, to test this out.

But believe me, when I get the chance, I will.

Scott

Comments (6) -

voyance gratuite immediate
voyance gratuite immediate
5/29/2013 3:27:53 AM #

Calculer astrologie chinoise themes astral gratuit

Take a look at my webpage -  voyance gratuite immediate - http://www.mavoyancegratuite.biz

check out the site
check out the site
5/30/2013 3:43:51 AM #

Hi there, I found your web site by way of Google at the same time as looking for a related topic, your site came up, it looks good. I have bookmarked it in my google bookmarks.
Hello there, simply become aware of your blog through Google, and located that it is truly informative. I'm going to watch out for brussels. I will appreciate if you proceed this in future. Many other folks will likely be benefited out of your writing. Cheers!

Also visit my webpage;  check out the site - http://beeeper.net/amie2

Link
Link
5/30/2013 5:49:40 AM #

Your style is so unique compared to other folks I've read stuff from. Many thanks for posting when you have the opportunity, Guess I will just book mark this blog.

Here is my weblog:  Link - http://aryannations88.com.Websiterecord.com/

decodeur tnt
decodeur tnt
5/30/2013 6:26:47 AM #

Wow that was strange. I just wrote an incredibly long comment but after I clicked submit my comment didn't show up. Grrrr... well I'm not writing all that over again. Anyhow, just wanted to say great blog!

Also visit my web blog ::  decodeur tnt - http://www.decodeurtnt.net/

continue reading this
continue reading this
5/30/2013 10:36:25 AM #

This post is genuinely a nice one it helps new the web people, who are wishing for blogging.

Here is my webpage  continue reading this - wgts-directory.com/seostats/dailygamecock.com

read more…
read more…
5/30/2013 8:18:27 PM #

The entire idea behind the P90 yourself will you still like them? Meats, doughnuts, fries, potato chips, and then begin the second phase order of p90x ab ripper x of the classic. The work order of p90x ab ripper x out programs are not just meant time two hours and thirty minutes and as a result you've got to be significantly more focused.

Also visit my website ::  read more… - www.toptopsites.com/index.php