HaveAByte (11/10/2008)Hi guys,
So as I add more customers to the HaveAByte.com hosted AyaNova service, each one requires their own Generator service to be set up and working. Unfortunately this comes at quite a cost: 33 MB of RAM per instance, which is quite a lot.
Hi Erik, just working on some performance and memory optimization stuff for v5 and came across this again and it didn’t sound right at all so I double checked and v4 AyaNova generator uses around 6mb of private non shared memory per instance, not 33mb.
I suspect you’re getting that figure from Windows Task Manager which does not show the amount of memory that process has held on to and cannot be shared, it shows a different value basically any memory that the process has touched and a very large chunk of memory that the .net memory manager has spoken up for but has not actually held, it’s thinking ahead for performance reasons and so it speaks up for a big chunk of memory, however that memory is free for anyone else who needs it, it’s just putting a light hold on it in case the application quickly needs it and generator does not need anything like that amount.
It is not an accurate figure if you are determining how much ram you need because the great majority of that figure is memory that is actually free to go to anyone else who want’s it should memory get low enough that it would matter in the operating system.
You can get an accurate figure for ram that is held and not usable by any other process by checking the Private Bytes performance monitor counter or use a tool like process explorer and check the performance properties private bytes which I just did for v4 generator and it gave a value of 5,912kb.
.net memory management is a complex subject, there is a fairly clear analogy here that explains reserving the big chunk of memory and why you can’t go by the task manager figure:
Basically in a nut shell unless you are getting an out of memory exception everything is fine and as a rule of thumb I would plan on having about 7mb of physical ram available beyond the amount consumed by the os and other applications for each instance of generator you want to run.
Also as I mentioned before we’ve made a tweak to allow a different connection to be made while the same application is using the AyaNova business object library which means an app can be loaded once then change connections sequentially to different databases and login again so that in theory only 6mb of ram in total would be needed for all your generators if it was coded to allow sequential processing of different customers databases, however you might not want to do that now that I’ve had more time to think about it:
First off there is a definite performance hit right off the bat because it takes time to connect, initialize and login which though small could add up quite a bit depending on how many different databases you process in a row, but there is a far more serious potential issue here.
Imagine that one of those databases being processed has some kind of problem with it that stops the generator or freezes it for whatever reason, now all your eggs are in one basket so if any one of those has a problem now they all have a problem because no further generation is taking place.
With the incredibly cheap cost of ram these days I personally would take the approx 6mb per database hit and run them all separately, a 1gb memory module is currently selling for as low as 9 dollars and even decent ram is 30 dollars a gb and thats enough extra ram for at least 130 generators to be running at once, however the option will be there if you want to go the other route with v5 and code up an alternative wrapper for the generation function built into the business object library.