We are planning to move our web application to web garden environment.
We are leaning towards Windows Server App Fabric Caching to provide distributed caching.
Is it the right approach?/
Is there anyother way to achieve distributed caching apart from Appfabric Caching?
The web garden is many pools on the same computer. So you have only one computer, so any cache application that store the cache on the database on the same computer can do the work.
The key point here is to have a database to keep the cache, because pools can not direact talk to each other and share resources, and the only way to have share data (like cache) is using common database, or common files, or common memory file-map.
The most safer, faster and ready to go is the database.
The Windows Server App Fabric can hold that, can also hold many other computers.
(source: microsoft.com)
Alternative, for web garden and a single computer, if you can handle a database on your project you can easy create your own cache, with a single table, and using mutex for synchronize the data
Related
I have an asp.net web api application should I use Self Hosting or should I host it on IIS. I am looking for better performance and security. Which one should I be using?
I just show the answer from here.
What I've found (basically just pros for IIS hosted):
You lose all of the features of IIS (logging, application pool scaling, >throttling/config of your site, etc.)...
You have to build every single feature that you want yourself HttpContext?
You lose that since ASP.NET provides that for you. So, I could see that making things like authentication much harder WebDeploy?
IIS has some nice specific features in 8 about handling requests and warming up the service (self-hosted does not)
IIS has the ability to run multiple concurrent sites with applications and virtual directories to advanced topics like load balancing and remote deployments.
And this
Self-hosting is good when you're not on a server -- for example, you want a desktop app to be able to listen for API requests.
But I think you would be able to achive am faster performing and more stable server if it is worth your time. But you need to be carefull not to make basic security mistakes like public accessable configuration files or ddos.
I apologize right away if I misuse my right to ask questions here. Yet, being a tyro in web development and an ASP.NET beginner, I need some advice from the experts.
I have developed an ASP.NET WebForms application which I would like to deploy to a remote hosting server. The application constantly queries and updates the database due to its purpose of being a document registration system. It will be sold to different institutions so that I've imagined the following scenario: host the app on the same server for all the institutions and have the databases on a different server or on multiple different servers. I have considered this option because as the data amount expands the storage provided by hosting companies may be insufficient.
My question is: is it possible to accomplish this scenario and if yes what are the risks and how should I do it?
Thank you very much!
Yes, it is a normal way to do it. However, you need a fast network connection between the web server and database server. You would also need to consider the service level (ie percentage up-time) and how much redundancy is needed to achieve that.
There's an easy way and a harder way to achieve this.
The easy way is to host your application in Microsoft Azure. It is fast to implement and very flexible.
You can host the database in SQL Azure Database, which Microsoft recommend for new development. This can be scaled from very small (and low cost) to very powerful (more cost).
Similarly the web application can be scaled. You can scale it vertically, by making the machine more powerful, and horizontally by adding more machines.
For both the database and web application, the scaling can be changed up or down in a few minutes.
The harder way is to host the application on virtual machines. You would need a lot of knowledge to configure and maintain this. For instance, you might need to configure SQL Server AlwaysOn.
This screen picture shows how you can select the pricing tier for a web application hosted in Microsoft Azure. (Prices are in GBP.)
You should host the web app and the database in the same data centre to ensure there will be fast network connections between them. Also you can make them belong to the same "resource group", which tells Azure that they work together.
This shows how you can select the level for a SQL Azure database. (Prices in GBP.)
See Microsoft Azure > Azure pricing: https://azure.microsoft.com/en-gb/pricing/
You could do it, just consider the speed between the hosting server and database server.
I have been reading all over the place about the new MemoryCache class starting in .Net Framework 4.0. From what I've read, you can access the MemoryCache across different .Net applications. I am trying to share an object between an Asp.Net application and a standard windows forms .Net application. If I add the object to the MemoryCache in the .Net application, the Asp.Net application does not see it. Is there any way to accomplish this? Thank you for your time, it is greatly appreciated.
Windows Form App:
Dim cache As ObjectCache = MemoryCache.Default
Dim policy As New CacheItemPolicy()
policy.AbsoluteExpiration = DateTimeOffset.Now.AddMinutes(60)
cache.Set("testcache", TestObj, policy)
Asp.Net App:
Dim cache As ObjectCache = MemoryCache.Default
If IsNothing(cache("testcache")) Then Response.Write("TestCache Is Nothing")
Thanks -
Ryan
No, that's not possible. MemoryCache is not a distributed caching solution. So it will only be available locally.
If you are looking for a distributed cache alternative you may want to look into AppFabric or Redis.
However, it does sound a bit like an odd architecture to want to share the cache that way.
Maybe exposing a shared services layer, that both the asp.net and winforms consume, and have just the services implement the caching would seem more logical (take into account I actually know nothing about the problem you are trying to solve, so I could be wrong).
Caching is more commonly used for performance reasons, not as a way to share data among applications.
MySQL memory tables are working great and having stellar performance. 20/30 inserts a second and only around 1% CPU load.
I realize this advice is not timely, but for others reading this question, another possibility is Interprocess Communication (IPC) between the two programs. This way the two programs can exchange messages/data directly without going thru an intermediate.
https://msdn.microsoft.com/en-us/library/windows/desktop/aa365574(v=vs.85).aspx
From the documentation above, here are some of your options.
Clipboard
COM
Data Copy
DDE
File Mapping
Mailslots
Pipes
RPC
Windows Sockets
In your case, mapped memory files might be the best approach as it allows for a shared memory space between applications. Fundamentally, your MySql/Redis approach is probably not that different.
if you are interested in :
single server multiple applications - memory share
you should consider create web api at the same node and consume it (simple key value API)
and use simple Memory Cache provided by .net framework
multiple servers - memory share
free $$ solution
you can use "Distributed SQL Server Cache", allows the
distributed cache to use a SQL Server database as its backing store.
To create a SQL Server cached item table in a SQL Server instance,
you can use the sql-cache tool. The tool creates a table with the
name and schema that you specify.
if you have a cluster of nodes you can use NCache it is
an open source in-memory distributed cache developed natively in
.NET and .NET Core. NCache works both locally and configured as a
distributed cache cluster for an ASP.NET Core app running in Azure
or on other hosting platforms.
solutions that require paying money:
NCache mentioned previously, there's Professional and Enterprise solutions,
or
Redis Cache - Redis is an open-source in-memory data store, which is often used as a distributed cache. You can configure an Azure Redis Cache for an Azure-hosted ASP.NET Core app, and use an Azure Redis Cache for local development.
I have a partly developed asp.net application, but now the client wants it to be developed in azure. How much of the existing code can be used in developing the application in azure.
What challenges could we possibly encounter when we try to port an existing asp.net application to azure? Are there any other alternatives to azure in cloud computing?
For an asp.net application, you can certainly port that to Azure. Your core logic will port in a relatively straightforward manner, and you'll gain the many benefits Azure has to offer. With the June 2010 release, you'll also have .NET 4 support, along with IntelliTrace for debugging.
However, as you begin to plan your Azure migration, there are several considerations you'll need to think about (none of them insurmountable, and several relatively simple to deal with):
You have to deal with ASP.NET Session State management across your web role instances (which isn't supported out of the box, except for inproc). You'll also have to set up and use the role and membership providers (see here for more detail). EDIT: You now have access to both AppFabric Cache for session state as well as SQL Azure, part of the Universal Providers included with the Windows Azure SDK+Tools.
You have to examine your SQL backend for incompatibilities with SQL Azure (such as scheduled jobs,since there's no SQL Agent support). SQL Azure differences are documented here. You'll also need to consider the SQL Azure size limit of 50GB, which might require you to offload content to Azure blob storage. EDIT: You can run your SQL Server database through the SQL Azure Migration Wizard for compatibility-testing.
You need to configure logging and diagnostics, preferably with Trace output, so that you can retrieve this data remotely.
You need to think about how you'll monitor and scale your application. All information you might need for scaling is available to you (performance counters, queue lengths, etc.). Check out WASABI - the auto-scale application block, part of Enterprise Library. You can also subscribe to a service such as AzureWatch.
You'll need to think about caching, as there's currently no out-of-the-box caching implementation that runs across instances of your web role which is now provided as a service. Read details here, as well as an FAQ here.
Do you need SMTP support? If so, there are details you should read about here. SendGrid recently announced a free-tier promotion for Windows Azure.
Are you hosting WCF services as well? If so, check out this site for further details (specifically the Known Issues).
So: yes, there are some things you need to concern yourself with, but Azure is a great platform for hosting an asp.net application and you should strongly consider it.
It should be very easy to port your application to Azure--especially if you're using a SQL back-end. The code could run almost without modification. You'll need to create an Azure installation package for the project and configuration file.
If your application makes use of persistent storage (other than SQL Server), you may have to rework that code somewhat. However, the platform now has drive storage, which simulates a file system, so this should be fairly easy.
Another issue to watch out for is web.config. If you make heavy use of this for runtime customization, you'll have to rework that too. You can't deploy single files to your application in Azure, so the recommended approach is to migrate these sort of settings to the Azure config file.
The hardest thing you're likely to encounter is external applications. If your app relies on launching other processes, then this will require some serious redesign.
Azure now supports Web Sites as a deployment type. Basically this allows you to publish any standard Asp.net (and other supported like PHP etc) application to Azure and have it as a scalable server. See this article http://blog.ntotten.com/2012/06/07/10-things-about-windows-azure-web-sites/
Many of the benefits of Azure without having to introduce Azure specific code/Project to your existing application.
Also this question here What is the difference between an Azure Web Site and an Azure Web Role
I have an ASP.NET application that makes extensive use of ASP.NET cache API for caching commonly-used data. In addition, I am using polling-based sql cache dependency to track expiration.
The drawback of the current design is that, in the web farm environment, each web server has its own data cache that is not shared across servers.
Is there a way I can simply migrate the code to share data cache across multiple servers?
I've thought of using memcached however that would not work with sql cache dependency, right?
Any other solutions?
Have you looked at Windows Server AppFabric (Formerly Velocity).
http://blogs.msdn.com/velocity/
You could use following options -
Use the approach described here for synchronizing the data across web farms -
http://www.eggheadcafe.com/articles/20030420.asp
Use distributed caching approach
Use enterprise library cache.
It seems to me that Windows Server AppFabric is exactly what you are looking for. (AKA "Velocity"). From the introductory documentation:
Windows Server AppFabric provides a
distributed in-memory application
cache platform for developing
scalable, available, and
high-performance applications.
AppFabric fuses memory across multiple
computers to give a single unified
cache view to applications.
Applications can store any
serializable CLR object without
worrying about where the object gets
stored. Scalability can be achieved by
simply adding more computers on
demand. The cache also allows for
copies of data to be stored across the
cluster, thus protecting data against
failures. It runs as a service
accessed over the network. In
addition, Windows Server AppFabric
provides seamless integration with
ASP.NET that enables ASP.NET session
objects to be stored in the
distributed cache without having to
write to databases. This increases
both the performance and scalability
of ASP.NET applications.