We(our company) is hosting a asp.net C# Cloud Services with a Web Role for a Reporting WebSites.
Unfortunately, usage of the reporting Website is growth that original is only hosting with Medium Size VM and find out its having a memory leak that cause the Cloud Services is always down and stop working. End up we move to A7 VM(Okay, thats expensive) that solved our problem for 2-3 month.Somehow, new stuff develop new function develop that end up the memory is more than enough(its 56GB RAM) but the process is not really can fulfilled such expensive usage in the same time.
Looking for solution on the web and found out there was a shared cache that can be used.
We decided to move from A7 to XM VM (A7 not supported shared cache) and with a Dedicated Roles For Shared cahce.
What we wish to achieve is load balance between few instances(if one down, it will redirect to another instances) and having the dedicated roles stored all of our session stuff.Am i going the correct direction for this?
And if yes, how to achieve this? I look into this and is that really need to sign up a preview program for cache services for using this?
Appreciate for the advice and please point out my mistake if any.
**Somehow, after reading stuff from web i found out the above mention method is a new method and the old ways is In-Role Cache that i can see it from here. Is that possible to used this method for sharing Session State among multiple instances even if one of the instances is down and route to another instances that are available and used back the session?
The best option for you is to use the Windows Azure Cache Service (Preview). This will let you share session state among multiple instances of your application.
You will need to sign up for the preview service. the cache core is mature and customers are encouraged to use this service in their production applications.
This service lets you use the cache from multiple cloud services, allowing you to share data across applications too. Also, this removes the dependency for you to use XL VMs just because In-Role Cache wasn't supported on A7.
Also, to be clear, Cache has 3 flavors -
1. Shared Caching - This is a multi-tenant service and is being deprecated
2. In-Role Caching - Here the cache is deployed in your cloud service and can only be used from within the cloud service. This is of two types - Co-Located & Dedicated.
3. Cache Service (preview) - The newly released service.
There is nothing called Dedicated Shared Cache. :)
Related
We have a multi-tiered architecture running .Net on the UI, then various other tech on additional EC2 instances.
Using load balancers from Amazon's web services, we can scale up as many of those instances as required by the usage. However, we have a big problem with multiple Web UI services.
A User logged in from the 1st instance of the Web UI, cannot make calls to/from the second instance of the Web UI. The Anti-Forgery token prevents this and results in a lot of errors. It doesn't take long and the entire system starts hanging, running CPU usage to 100% and crashing.
I've tried/found:
Removing all Anti-Forgery attributes. It did not work, plus it leaves us open to attacks.
Sharing the Anti-Forgery token and session information across to the other instance. Not sure how to do this cleanly, and it violates our security settings.
Isolating User's to only a single instance... but I cannot find a way to implement this. Only seen a few mentions of it.
I've googled quite a bit and haven't had any luck finding a solid solution.
This is an emergency, so any ideas would be greatly appreciated!
Thank you in advance.
Update:
Here are some resources we are finding:
https://aws.amazon.com/getting-started/hands-on/setting-up-a-redis-cluster-with-amazon-elasticache/
.net + Sharing session over multiple servers with redissessionstateprovider + sessionstate custom mode
Kubernetes + Redis: The antiforgery token could not be decrypted
Good video tutorial for .NetCore: https://www.youtube.com/watch?v=jwek4w6als4
Let us say i have a website developed in asp.net webforms on .net 4.0 frame work and this needs to be migrated to cloud hosting like rackhosting.
This website currently uses asp.net default membership for user management and also uses several session variables for storing temporary variables.
This website is hosted on a dedicated server hosted inhouse.
so my question is
How to make it work on cloud hosting
One way of doing could be using MS Sql Server based session management
What else i need to take into consideration to make it work on cloud hosting
I have no experience with cloud hosting as one gets confused with the cloud hosting architecture provided by service providers. Microsoft Azure, Amazon etc..
any pointer to a good article and code examples would be great to start with
You will need to use a Session State Provider that will span the servers.
e.g. one that uses App Fabric (or other caching provider) or Sql Server
For sharing sessions you have 2 options:
1. Sticky sessions, easiest to implement because there are no changes to do in code, but you will not be able to autoscale (add or reduce the number of machines based on load). This will be just a setting on your load balancer, so you need to check if the load balancer of your cloud provider has this.
2. Out of proc session and here I suggest to use the ASP.NET Redis session provider (supported by Microsoft). Both AWS and Azure provide Redis as a servce, so it is easy to start with, you don't need to think of its administration. Most important out of proc will mean some code changes, at least marking your classes that go in session as Serilizable, but you will be able to autoscale.
I have hosted my website in microsoft azure web role. My website works like application and service. Each time user approaches the site, request goes to the service, finishes its database related queries and return backs to application part. Since it has two ways, i have used web roles for both application and service.
If the number of users reaches maximum, an instance is created in web role, what would happen to my service side since it involves database related things.
Everytime when the instance is created, would database be created along with that?
In my case, i would like to see everytime instance is created, no duplicate database should be created. Is it possible? If its possible, do deadlock occurs in that case?
Is it possible to host a application and service both in same web role. If so, i would like to see only database should be created each instance is created.
Please provide a clear solution on this.
Assuming that the application and service are running under two separate cloud services:
Your Application and Service roles are configured to scale independently.
Assuming your are using an Azure SQL Database, it would also be scaled independently of the cloud service.
No duplicate database would be created - Azure SQL databases would again be scaled independently of the cloud services.
If your Application is, say, an ASP.NET MVC application, and your service is a WebAPI, they could both be hosted under the same cloud service (they'd be in the same web application)
How your Service application would behave in a scaled scenario will really depend on how it's been implemented.
I think you have a misunderstanding about how scaling works with Azure.
Check here for some additional detail: How to Scale a Cloud Service
As an aside, you may want to consider Azure Web App instead of a Cloud Service. Whilst they offer less control that a cloud service, unless you are doing something specific that an Azure Web App can't offer, they are easier to deal with.
Are there any special considerations when Caching ASP.NET Pages on Azure?
I understand that page caching is managed in memory by IIS, but does it rely on the same providers as asp.net caching?
I need to cache hundreds of pages each averaging 100KB and I wonder if this will function on Azure as expected because there is a memory limitation considerations on Azure.
I'd recommend Azure Cache services for Output Caching ASP.NET pages. It's simple to configure and can be used by all VM nodes in your deployment.
Azure Cache relies on DistributedCacheOutputCacheProvider. You can also control your Cache Quota size.
Completely agree with #SilverNonja comments however I just wanted to comment about "Memory limitation consideration on Azure". I don't consider your objective is limited due to the limitation in Windows Azure memory because you sure can get a lot in single VM however can u server that many user from one single VM. You really have to run multiple instances of same application and then having the local machine specific cache is the problem.
With Cloud solution where you have more then one instances are running creating a local cache based solutions bring several problems because the requests are being served by different instances at different times. Having a centralize location for shared resources is the best where all the instances can look for the data is the best method and that's why Windows Azure Cache is the best/fast option available for you to use.
Also here is very Simple Sample to use Azure Cache with ASP.NET application:
https://www.windowsazure.com/en-us/develop/net/how-to-guides/cache/
You might wanna try the latest Windows Azure Caching (Preview). It has a better feature set and improved latencies. For more info - http://social.msdn.microsoft.com/Forums/en-US/windowsazuredata/thread/9a2dbd9f-1b9d-4249-a48b-216d9dfdc2bc
I want to get started with amazon web services simply to stream books searched for through a custom web site not yet deployed. So I want to create a free account, but I see they have all these other services like cloud, etc. that they may try to rope you in... I just want to use the web service, is there a test web service for applications currently running on localhost, that will only use the web service portion? Or do I create the account and provide no current business info? Or how does this work?
I guess my confusion is also that Amazon offers so many services, and I don't understand what each of them is for too... and what I should be looking at.
Thanks.
You just create an account. There is no current business info to provide.
Yeah, you need a credit card.
However, nothing ever gets charged, unless you actually use one of these services. In my experience these are all extremely cheap to try out and get started with (see AWS Simple Monthly Calculator)
You probably just want to use S3 (for serving static files - with the option of torrenting t
hem (!)) or EC2 (for temporary (auto) scalable webservers machine instances