0

I have an in-memory list of objects (really just strings) I utilize in a .net web application. It is about 10 megs worth of data, so I just keep it in ram and don't mess with a database etc.

However, now I need multiple web apps to access this same data. First thought was to add a web api on top of this and give access to the additional apps through the api. This should be better than having each app keep the same 10 megs of data loaded in ram.

But this made me wonder if there's a more performant way to do this in .net on a single server- allow multiple web apps to access the same in-memory data, without the overhead of a web api, and without resorting to just having each request hit a database. I realize the performance benefits may not make it worthwhile, but am just curious if such a thing is possible.

Brady Moritz
  • 8,624
  • 8
  • 66
  • 100

2 Answers2

2

If you use WCF with a transport optimized for communication between processes on the same machine (e.g. Named Pipe binding), you will have all the convenience of a web-API-like programming model without the overhead. And if you ever need to use multiple machines in the future, changing to a different transport (e.g. TCP or even HTTP) will be as simple as changing a config file. Take a look at http://msdn.microsoft.com/en-us/library/ms752247(v=vs.110).aspx (and http://msdn.microsoft.com/en-us/library/ms752250(v=vs.110).aspx for TCP)

Eugene Osovetsky
  • 6,443
  • 2
  • 38
  • 59
0

You could look at something like AppFabric or possibly a document or key/value database. I've used both for various clients to access the same information with great success.

Antony Scott
  • 21,690
  • 12
  • 62
  • 94