Running .NET WinForm Applications on Citrix

We have been creating a major .NET WinForm application that will be deployed in Citrix for a few months now.  Basically, think of it as a custom rewrite of MS Access (note that this wasn't a techie's idea) that works against MS SQL Server.  Of course, business as usual doesn't like any limitations, so we have way too much data and far too many features to work in a shared environment like Citrix.  Or do we?  That has been the bane of my existence for the last couple of months, and unfortunately there doesn't appear to be many others that have such experience to share.  My main concern has been whether or not the .NET garbage collector would see the 4GB of RAM and think it could have it all, unaware of the other users on the box.  I have posted that concern to various forums several times, and I've seen a few others with similar concerns, but no one ever answered, other than people telling about .NET works in general without any Citrix experience.

Well I can finally report that things look pretty good afterall -- after much painful performance tuning and tracking down a memory leak in a 3rd party grid control.  There were many small performance gains, but the biggest one is something I still don't understand, but the numbers are proof.  Basically, we have a business class that has a method that gets a DataSet and stores in one of its members, and then the calling class separately sets the grid's datasource to the class property that exposes that member.  It seems like that would be fine, since a DataSet is a reference type, but it turns out that setting both the class member and the grid datasource in separate steps takes twice as much time as having the class method set the member and then return it to the caller!  I would love it if someone can explain that one to me -- my team told me it didn't work this way, but the numbers are proof, and none of us understand it.

So we were hoping for good results with our test this week -- sure enough, the first 45 minutes testing the application in Citrix with 15 users looked very good from a user's point of view.  But then things started grinding to a halt, and didn't pick up for 30 minutes when most of us started closing and restarting the application.  The naysayers in our company quickly released their observations that our application could not even support 15 users, which isn't very good in an expensive Citrix environment.  The infrastructure guys pointed to some poor .NET performance counters -- but wait, those numbers didn't get bad until 15 minutes after everything went to crap, and all the .NET numbers before then looked sweet.  The problem instead is obvious when you look at the overall memory numbers -- there was a gradual memory leak, unrelated to .NET, that eventually swamped the system, and eventually that also affected the .NET numbers.  I finally found the control, the 3rd party grid, that had the memory leak, and it turns out they already knew about this and had a hotfix, not to mention a newer version that we were still investigating.

We will now start updating that grid control, and I hope to soon be able to report a better test result in Citrix.  There may still be problems, but the numbers once again speak for themselves, and I think its pretty clear that our .NET app ran better than Access and our older Access-like applications that we are trying to replace.  The naysayers see .NET start with 20MB and freak out saying that its not going to scale, but that initial grab doesn't mean it takes 20MB to run the app, it just means .NET is getting memory so it doesn't have to later.  Its actually quite an incredible feeling to look at the graphs of .NET's memory and garbage collection when you have 15 people on a Citrix box, each looking at about 3 separate instances of our main view, each having an average of 25000 rows of data (some much more), averaging 25 columns (but some with more again).  .NET works great, and so does MS SQL Server, which we use exclusively with some of the world's largest databases -- that's right, we don't have any instances of Oracle at all.  Life is good.

Update: Life is NOT good since none of the global .NET memory performance counters that I relied on actually work!

19 Comments

  • Hi,



    I'm looking at building a win form app running on citrix for one of my client. Thank you for the heads up. More info regarding performace once you sort out your 3rd party control problems would be great.



    Clarke

  • We are just starting to look at some .NET in a Citrix MetaFrame environment, though none of it is WinForms. As you pointed out, it is really difficult to get clear answers on this, isn't it?

  • Loading a DataSet while it's bound to a DataGrid, is much slower than loading it and then bind it. That's probably the issue you are running into.







  • I just by happenstance noticed this blog. My company is, from what I understand, Citrix's largest deployment of a server farm. I don't know what the count is but I know our server farm is 100+ running citrix and of those 25 boxes will be used for an application we are developing using .NET winforms also (using several NLB App Servers, SQL 2000 and remoting). The application is basically a CRM app with a bunch of other fluff. We will be starting up some System Testing in a couple weeks across a couple servers with about 20 testers. Within a couple months our training environment will be handling about 300+ users and our final deployment will be around 3000 users (1200+ simultaneous) across around 25 servers slated for june. I'd be happy to share my experience with you guys if you'd like (unofficially of course).



    I was in the same boat as you guys when we were looking for any real world, large scale, .NET winform citrix deployments but came up with Nill and we've had to rely on the fact that they're both supported environments for .NET. We also have a third party grid that I'll now keep a close eye on hehe (infragistics).



    Regards,



    Josh

  • Hey Josh:



    I don't know if we have a 100 yet, but I know we will by the time this project is rolled out to everyone, since this project alone will have over 50 citrix boxes when done, on top of quite a few we already have. I'd love to hear (unofficially drop me an email) more about your experiences since it sounds like you've gotten farther than us. BTW, Infragistics is what we're using too -- the leak was in an early version of 2.0, the fix was out a long time ago, and hopefully everything is still good in 3.0. We do know that 3.0 performs overall much better than 2.0, but we're still talking about using a custom version since we have the source and have already found some problem areas. I'm in Atlanta -- where are you?

  • We have a WinForm application running on a Citrix that is having an interesting problem. We are having a problem where the application hangs after a period of time and the application throws a "unhandled exception error". It seems to be coming from the 3rd party Grid that we purchased. Does this sound similar to your memory leak issue?

  • Hello Paul,



    I work for a firm that is also currently trying to deploy a .net application on Citrix. I was wondering if it would be possible to give even a ballpark of the kind of hardware that you were running citrix/.net app on?



    The reason this is of interest is our numbers are not much better than you have described here, getting about 15-20 users per citrix box (.net app + citrix). In our case the average Citrix box has a single 3.0 GHz CPU and 2GB of RAM.



    Any feeback would be a huge help! thanks!



    Raif






  • Our boxes were dual-processor with 4 GB RAM -- I don't know the CPU specs. Keep in mind our biggest problem was the very bad business requirements to allow unlimited number of records in a rich grid control with too many other features to count. I honestly believe a better set of requirements would have yielded more users per box, although I also am not convinced it would ever get the 50+ users that were common with Access and other non-.NET apps!

  • Thanks for the feedback Paul!



    We have exactly the same issue here, as our client wants complete sets of data in the grids (no record limits). So we end up in some cases with very large memory requirements to load in all that data, just so they can get the same rich grid controls that you are likely describing.



    I am also convinced based on our observations that 50 users would be an amazing feat for a .net application via Citrix. At least an application that loads such large sets of data.



    I have a round of more interesting testing to be done on this whole setup in the weeks/months ahead. If I find anything that might be of help, I will let you know!



    Thanks Again,



    Raif

  • I may be sounding novice in asking this question, but would like to know:
    Is there any specific coding we need to do in our existing application ( mine is a vb 6.0 appln) so that it runs w/o problems in an citrix enviro?

    prompt reply will be appreciated.

    Thanks
    LS

  • There's just a few things, although I may not recall the exact list either, so I would still recommend you looking this up officially (I know I've seen such a list online and in books in the past). The things I recall are that you must not assume local file paths -- instead you should use the appropriate APIs to get the user's assigned folder on the network. I think that you were also not allowed to use the registry to store information, or at least you were limited in some very real ways. There could also be some issues with permissions if you assume users have more than the minimal assigned -- so overall you should keep in mind that users are not working in an unrestricted local environment.

  • Does anyone have any thoughts on deploying the WinForm app in a Citrix environment? Specifically how to get around locked assemblies? Our current solution is to kick everyone off the server and then copy .dll's. Since this is a 24x7 operation, not very convienient.

  • Something we were considering was each user having their own \bin folder on a shared file server (This is a users F:\ drive in our mappings).

    This would mean each user would be running their own DLL's & we could force updates to the F:\bin folder whenever we wanted. We have an application launcher program that checks versions when starting a process and forces updates where nescessary.

    Now this does 'work' but I think it introduces a number of problems. In particular, there is a perf hit when assemblies are loaded at run time. If your network has a blip, the app would probably fall over. Also, I have been suffering with the 'External Component has thrown an exception' error which I'm fairly certain will be resolved by deploying locally.

    I was weighing this up as a control vs performance offset...I would like to be in control of the applications' deployment and any hotfixes I needed to apply...but, I think instead I'm just going to deploy on C and be really careful with application updates. We have to schedule in the updates with the Citrix farm team who then update a single server and roll out the image to the farm. This means updates can only take place out-of-hours & we have to be really careful with our QA stage...!

    Is something like this not possible in your 24x7 environment? Is there never a point when there are no users using the assemblies?

  • One of the main reasons for using Citrix is to simplify deployment, so I can't imagine ever creating user specific deployments as you've describe. As for how to manage deployment, my experience is that companies that invest in Citrix also invest in the appropriate people with experience in Citrix deployments, which typically involves some serious planning. I do not have any idea what all the options may be, but I have seen weekly windows for Citrix maintenance, usually at times to affect the fewest people in a global company.

  • I was wondering if anyone had tried running a Webform application on Citrix? We have a case where once the citrix session starts and calls the web form, the focus should be on the text box on the form.

    However the focus seems to still be on citrix and the user has to click in the textbox (even though the cursor is in the form - when you type, nothing appears) to enter text.

    Any thought?

  • I've personally not worried about web apps on Citrix -- I'm also not real sure why you would bother to do so.

  • We have clients that are running very old slow machines. They are going to connect to our new Citrix servers to kick off some desktop applications as well as our web applications. (Citrix talks to our web servers). With over 100 different client locations and 5-10 machines at each location, this was a less expensive way to upgrade the client's environment

  • We're also trying to run .NET winforms on citrix using infragistics. Our app's are copied to a file share, and then the exe is fired up from there. We copied our infragistics dll's along with the rest of the files in the bin directory to that file share. When the users start up the exe, it just opens the form and shuts down. If we copy the same files over to a PC, it works fine. Has anyone else run in to this situation in regards to using the infragistics controls in a citrix environment deploying to a file share?

    My thoughts are that we would need to register the infragistic dll's in the GAC of all 3 citrix boxes we have.

  • A file share is just where something is stored -- it does not actually run on the file share. So yes, if something is necessary to run the exe, then it must be installed on the boxes that are going to actually run it -- citrix boxes in this case.

Comments have been disabled for this content.