Geeks With Blogs
Saqib Ullah BootStrapper Know How

Error:

 


There is a temporary failure. Please retry later. (The request failed, because you exceeded quota limits for this hour. If you experience this often, upgrade your subscription to a higher one). Additional Information : Throttling due to resource : Connections."


If you Google this issue, you only find different blogs and forums where geeks discussing this issue and giving suggestion to each other.
Even when I counter this issue I also review my application architecture and I re-write the Azure Appfabric cache component on the
following concept.

 

One connection per web role instance for DataCacheFactory


Important thing that you want to keep in mind is only one instance of DataCache is created per instance of DataCacheFactory and
GetDefaultCache() returns back the same instance each time.

To get rid of from this error I created OnPremCache class that is accessible from Instance property (basically I implemented a singleton
class) and call my OnPremCache methods from WCF Web Role service. 

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.ApplicationServer.Caching;

namespace Saqibullah.Com
{
    public sealed class OnPremCache
    {
        private DataCacheFactory dataCacheFactory = null;
        private DataCacheFactoryConfiguration dcfc = null;
        private DataCacheLocalCacheProperties local = null;
        private DataCache dataCache = null;

        public static readonly OnPremCache Instance = new OnPremCache();

        private OnPremCache()
        {
            LoadCacheConfiguration("default");
            dataCacheFactory = new DataCacheFactory(dcfc);
            dataCache = dataCacheFactory.GetDefaultCache();
        }

        private void LoadCacheConfiguration(string defaultorSSLEndpoint)
        {
            dcfc = new DataCacheFactoryConfiguration(defaultorSSLEndpoint);
            local = new DataCacheLocalCacheProperties(1000, TimeSpan.FromMinutes(5), DataCacheLocalCacheInvalidationPolicy.TimeoutBased);
            dcfc.LocalCacheProperties = local;
        }

        public object Get(string key)
        {
            return dataCache.Get(key);
        }
      
        public void Put(string key,object obj)
        {
            dataCache.Put(key, obj);
        }
      
        public void Add(string key, object obj)
        {
            if (dataCache.Get(key) == null)
                dataCache.Add(key, obj);
        }
     
        public void Remove(string key)
        {
            dataCache.Remove(key);
        }

    }
}

 

WCF Web Role class and interface and sample Data class.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;

namespace Saqibullah.com
{
    [DataContract]
    public class Data
    {
        [DataMember]
        public string Emp_Id { get; set; }

        [DataMember]
        public string Emp_Name { get; set; }

        [DataMember]
        public string Emp_Designation { get; set; }

        [DataMember]
        public string Emp_Salary { get; set; }

        [DataMember]
        public string Emp_IsManager { get; set; }

        [DataMember]
        public string Emp_CasualLeaves { get; set; }

        [DataMember]
        public DateTime ServerDate
        {
            get
            {
                return DateTime.Now;
            }
            set { }
        }
    }

    [ServiceContract]
    public interface IService1
    {

        [OperationContract]
        Data GetData(string clientId);

        [OperationContract]
        void PutData(string clientId, Data obj);

        [OperationContract]
        void RemoveData(string clientId);

        [OperationContract]
        void UpdateData(string clientId, object obj);

    }

    public class Service1 : IService1
    {

        public Data GetData(string clientId)
        {
            return OnPremCache.Instance.Get(clientId) as Data;
        }

        public void PutData(string clientId, Data obj)
        {
            OnPremCache.Instance.Add(clientId, obj);
        }


        public void RemoveData(string clientId)
        {
            OnPremCache.Instance.Remove(clientId);
        }

        public void UpdateData(string clientId, object obj)
        {
            OnPremCache.Instance.Put(clientId, obj);
        }
    }
}

Posted on Thursday, October 13, 2011 3:20 AM Cloud , Azure | Back to top


Comments on this post: Azure Appfabric Cache connections throttling issue

# re: Azure Appfabric Cache connections throttling issue
Requesting Gravatar...
Ya , Just notice solution. that was really fabulous way of representing
Left by Cleveland Design Build on Nov 29, 2011 6:25 PM

# hii
Requesting Gravatar...
The war came at a great cost in lives and economic damage—half a million Iraqi and Iranian soldiers as well as civilians are believed to have died in the war with many more injured—but it brought neither reparations nor change in borders.
Left by Rec to rec agencies Dubai on Dec 12, 2011 9:46 PM

# re: Azure Appfabric Cache connections throttling issue
Requesting Gravatar...
cool et merci pour cet article...
Left by Rencontre Webcam on Dec 29, 2011 11:25 AM

# re: Azure Appfabric Cache connections throttling issue
Requesting Gravatar...
the Paleo Challenge is concerned, the clean eating habits definitely stuck with me after it was over. so its definitely incredibly beneficial
Left by langweilig on May 19, 2012 5:57 AM

# re: Azure Appfabric Cache connections throttling issue
Requesting Gravatar...
Instance property (basically I implemented a singleton
class) and call my OnPremCache methods from WCF Web Role service.
Left by los angeles accounting firm on May 23, 2012 11:13 PM

# rock
Requesting Gravatar...
the clean eating habits definitely stuck with me after it was over.
Left by tax relief on Jul 23, 2012 4:56 PM

# re: Azure Appfabric Cache connections throttling issue
Requesting Gravatar...
Thanks a lot for providing the amazing info is visible in this blog that to sharing the great services in this blog.
Left by specialty fasteners on Sep 26, 2012 6:36 AM

# re: Azure Appfabric Cache connections throttling issue
Requesting Gravatar...
I have been to many websites for research and I can assert that it is one of the best informative resources I have used so far.
Left by legal marketing on Sep 30, 2012 8:17 PM

# re: Azure Appfabric Cache connections throttling issue
Requesting Gravatar...
I was trying this. but could not do it perfectly.you nicely showed the whole process.I am now confident about doing this perfectly.
Left by Weekly London Rental on Oct 29, 2012 3:46 AM

# re: Azure Appfabric Cache connections throttling issue
Requesting Gravatar...
It seems so mucheasy here.Now I cando it i think.
Left by hostel nyc on Nov 03, 2012 9:05 PM

# re: Azure Appfabric Cache connections throttling issue
Requesting Gravatar...
I think this is very wonderful article! I believe that we can see here, it will strive to do every step of the positive. Thank you!
Left by reverse mortgage for senior on Nov 26, 2012 8:32 PM

# re: Azure Appfabric Cache connections throttling issue
Requesting Gravatar...
I not to mention my buddies happened to be following the great pointers from your web blog and then then developed a horrible suspicion I never thanked the web blog owner for those techniques.
Left by pradaxa lawsuit on Nov 29, 2012 2:55 PM

# re: Azure Appfabric Cache connections throttling issue
Requesting Gravatar...
Great tip, the Azure Connections are working well again :-)
Left by Maria K on Dec 01, 2012 12:46 AM

# re: Azure Appfabric Cache connections throttling issue
Requesting Gravatar...
You provided a valuable service to the community. Thank you for doing such a great job all these years.
Left by mesothelioma law firm on Dec 03, 2012 7:14 PM

# re: Azure Appfabric Cache connections throttling issue
Requesting Gravatar...
Your article was very insightful. I shared it with my family and they enjoyed it too
Left by authorized user on Dec 04, 2012 12:40 PM

# re: Azure Appfabric Cache connections throttling issue
Requesting Gravatar...
It refers to the work done in providing primary care, secondary care and tertiary care, as well as in public health. Thanks
Left by san diego accident lawyer on Jan 01, 2013 12:24 PM

# re: Azure Appfabric Cache connections throttling issue
Requesting Gravatar...
Boy, was that a process. The title is trying to express all the strange juxtapositions that I experienced -- a tall white guy in western China
Left by beats by dre on Jan 05, 2013 7:01 PM

# re: Azure Appfabric Cache connections throttling issue
Requesting Gravatar...
Inkjet printer when not in use, it should be placed into the cartridge box, remove the print cartridge, and as much as possible to ensure that the cartridges ambient thermostat, not the cartridge placed directly into the strong sunlight. Inkjet printer you need to keep it clean in the state has not been used for a long. Is preferably back into the box, not exposed to the air for a long time to accumulate dust.http://www.britanniainks.co.uk/products/Remanufactured-PG-510-High-Capacity-Ink.html
Left by PG-510 on Jan 14, 2013 8:13 PM

# re: Azure Appfabric Cache connections throttling issue
Requesting Gravatar...
This worked perfect for my project. Thanks for Azure tips
Left by Lucy FAS on Feb 24, 2013 6:31 AM

Your comment:
 (will show your gravatar)


Copyright © Saqib Ullah | Powered by: GeeksWithBlogs.net | Join free