import{s as Ne,o as Fe}from"../chunks/scheduler.a045fce0.js";import{S as Ge,i as Ye,e as r,s as a,c,h as Be,a as u,d as n,b as s,f as je,g as f,j as m,k as Ie,l as Xe,m as i,n as d,t as h,o as g,p as $,r as we,u as ye}from"../chunks/index.c7f31426.js";import{T as $e}from"../chunks/Tip.06e542ce.js";import{H as B,E as Ze}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.8ed610dd.js";function Oe(w){let l;return{c(){l=we("In the Analytics section of the guide, you can read more about how to track all the metrics mentioned in this documentation.")},l(o){l=ye(o,"In the Analytics section of the guide, you can read more about how to track all the metrics mentioned in this documentation.")},m(o,p){i(o,l,p)},d(o){o&&n(l)}}}function Re(w){let l;return{c(){l=we(`Note that scaling up can take a few minutes depending on the model, which means that scaling from 0 to 1 based on a request is typically not recommended if your
application needs to be responsive.`)},l(o){l=ye(o,`Note that scaling up can take a few minutes depending on the model, which means that scaling from 0 to 1 based on a request is typically not recommended if your
application needs to be responsive.`)},m(o,p){i(o,l,p)},d(o){o&&n(l)}}}function We(w){let l;return{c(){l=we("Note that if scale to zero is enabled, the minimum number of replicas needs to be 0.")},l(o){l=ye(o,"Note that if scale to zero is enabled, the minimum number of replicas needs to be 0.")},m(o,p){i(o,l,p)},d(o){o&&n(l)}}}function De(w){let l,o,p,Z,_,O,x,ve=`Autoscaling allows you to dynamically adjust the number of endpoint replicas running your models based on traffic and hardware
utilization. By leveraging autoscaling, you can seamlessly handle varying workloads while optimizing costs and ensuring high availability.`,R,T,be="You can find the autoscaling setting for you endpoints under the “Settings tab” on the Inference Endpoint card.",W,C,_e='<img src="https://raw.githubusercontent.com/huggingface/hf-endpoints-documentation/main/assets/autoscaling/settings.png" alt="settings"/>',D,y,J,z,K,P,xe=`Scaling to zero means that your Inference Endpoint will go idle after a given duration (1 hour by default) of inactivity. This is typically
very useful when you want to optimize for low costs or when your workloads are intermittent.`,Q,q,Te=`Scaling to zero replicas helps optimize cost savings by minimizing resource usage during periods of inactivity. However, it’s important to
be aware that scaling to zero implies a cold start period when the endpoint receives a new request. Additionally, the proxy will
respond with the status code <code>503</code> while the new replica is initializing. To potentially avoid this, you can also add the
‘X-Scale-Up-Timeout’ header to your requests. This means that when the endpoint is scaling the proxy will hold the request until a replica
is ready, or timeout after the specified amount of seconds. For example ‘X-Scale-Up-Timeout: 600’ would wait for 600 seconds.`,V,v,ee,S,te,H,Ce=`With this setting, you can change the maximum and minimum amount of replicas. This means that you control the ceiling and the floor of your costs.
Typically, you’d set the minimum to a value such that at the lowest amount of traffic, you’re still serving your users at an acceptable rate.
And the maximum so that you stay within budget, but so that you can serve your users even at the highest points of traffic.`,ne,b,ie,k,ae,A,ze="For the autoscaling system to work well there needs to be a signal that tells when to scale up and down. For this we have two strategies.",se,L,le,M,Pe=`The autoscaling process is triggered based on the hardware utilization metrics. The criteria for scaling differ depending on the
type of accelerator being used:`,oe,E,qe="<li><strong>CPU</strong>: A new replica is added when the average CPU utilization of all replicas reaches the threshold value (default 80%).</li> <li><strong>GPU</strong>: A new replica is added when the average GPU utilization of all replicas over a 1-minute window reaches the threshold value (default 80%).</li>",re,U,Se=`It’s important to note that the scaling up process takes place every minute and scaling down takes place every 2 minutes. This
frequency ensures a balance between responsiveness and stability of the autoscaling system, with a stabilization of 300 seconds
once scaled down.`,ue,j,He='You can also track the hardware utilization metrics in the Analytics tab, or read more about it <a href="./analytics#hardwareutilisation">here</a>.',me,I,pe,N,ke=`In some cases, the hardware utilization is not a ‘fast’ enough metric. The reason is that hardware metrics are always slightly lagging from
the actual requests. A metric that is more of a leading indicator is pending requests.`,ce,F,Ae=`<li><strong>Pending requests</strong> are requests that have not yet received an HTTP status, meaning they include in-flight requests and requests currently being processed.</li> <li><strong>By default</strong>, if there are more than 1.5 pending requests per replica in the past 20 seconds, it triggers an autoscaling event and adds a replica to your deployment.
You can adjust this threshold value to meet your specific requirements under Endpoint settings.</li>`,fe,G,Le='Similarly to the hardware metrics, you can track the pending requests in the Analytics tab, or read more about it <a href="./analytics#pendingrequests">here</a>.',de,Y,he,X,ge;return _=new B({props:{title:"Autoscaling",local:"autoscaling",headingTag:"h1"}}),y=new $e({props:{$$slots:{default:[Oe]},$$scope:{ctx:w}}}),z=new B({props:{title:"Scale to Zero",local:"scale-to-zero",headingTag:"h2"}}),v=new $e({props:{$$slots:{default:[Re]},$$scope:{ctx:w}}}),S=new B({props:{title:"Number of replicas",local:"number-of-replicas",headingTag:"h2"}}),b=new $e({props:{$$slots:{default:[We]},$$scope:{ctx:w}}}),k=new B({props:{title:"Autoscaling Strategy",local:"autoscaling-strategy",headingTag:"h2"}}),L=new B({props:{title:"Scaling based on hardware utilization",local:"scaling-based-on-hardware-utilization",headingTag:"h3"}}),I=new B({props:{title:"Scaling based on pending requests",local:"scaling-based-on-pending-requests",headingTag:"h3"}}),Y=new Ze({props:{source:"https://github.com/huggingface/hf-endpoints-documentation/blob/main/docs/source/guides/autoscaling.md"}}),{c(){l=r("meta"),o=a(),p=r("p"),Z=a(),c(_.$$.fragment),O=a(),x=r("p"),x.textContent=ve,R=a(),T=r("p"),T.textContent=be,W=a(),C=r("p"),C.innerHTML=_e,D=a(),c(y.$$.fragment),J=a(),c(z.$$.fragment),K=a(),P=r("p"),P.textContent=xe,Q=a(),q=r("p"),q.innerHTML=Te,V=a(),c(v.$$.fragment),ee=a(),c(S.$$.fragment),te=a(),H=r("p"),H.textContent=Ce,ne=a(),c(b.$$.fragment),ie=a(),c(k.$$.fragment),ae=a(),A=r("p"),A.textContent=ze,se=a(),c(L.$$.fragment),le=a(),M=r("p"),M.textContent=Pe,oe=a(),E=r("ul"),E.innerHTML=qe,re=a(),U=r("p"),U.textContent=Se,ue=a(),j=r("p"),j.innerHTML=He,me=a(),c(I.$$.fragment),pe=a(),N=r("p"),N.textContent=ke,ce=a(),F=r("ul"),F.innerHTML=Ae,fe=a(),G=r("p"),G.innerHTML=Le,de=a(),c(Y.$$.fragment),he=a(),X=r("p"),this.h()},l(e){const t=Be("svelte-u9bgzb",document.head);l=u(t,"META",{name:!0,content:!0}),t.forEach(n),o=s(e),p=u(e,"P",{}),je(p).forEach(n),Z=s(e),f(_.$$.fragment,e),O=s(e),x=u(e,"P",{"data-svelte-h":!0}),m(x)!=="svelte-n9mkj5"&&(x.textContent=ve),R=s(e),T=u(e,"P",{"data-svelte-h":!0}),m(T)!=="svelte-ums6bn"&&(T.textContent=be),W=s(e),C=u(e,"P",{"data-svelte-h":!0}),m(C)!=="svelte-cj1mce"&&(C.innerHTML=_e),D=s(e),f(y.$$.fragment,e),J=s(e),f(z.$$.fragment,e),K=s(e),P=u(e,"P",{"data-svelte-h":!0}),m(P)!=="svelte-1nbwpml"&&(P.textContent=xe),Q=s(e),q=u(e,"P",{"data-svelte-h":!0}),m(q)!=="svelte-i6wd12"&&(q.innerHTML=Te),V=s(e),f(v.$$.fragment,e),ee=s(e),f(S.$$.fragment,e),te=s(e),H=u(e,"P",{"data-svelte-h":!0}),m(H)!=="svelte-1w6gfuq"&&(H.textContent=Ce),ne=s(e),f(b.$$.fragment,e),ie=s(e),f(k.$$.fragment,e),ae=s(e),A=u(e,"P",{"data-svelte-h":!0}),m(A)!=="svelte-37hx4r"&&(A.textContent=ze),se=s(e),f(L.$$.fragment,e),le=s(e),M=u(e,"P",{"data-svelte-h":!0}),m(M)!=="svelte-fmk3bj"&&(M.textContent=Pe),oe=s(e),E=u(e,"UL",{"data-svelte-h":!0}),m(E)!=="svelte-1ud0nw9"&&(E.innerHTML=qe),re=s(e),U=u(e,"P",{"data-svelte-h":!0}),m(U)!=="svelte-159ttyk"&&(U.textContent=Se),ue=s(e),j=u(e,"P",{"data-svelte-h":!0}),m(j)!=="svelte-1hsernu"&&(j.innerHTML=He),me=s(e),f(I.$$.fragment,e),pe=s(e),N=u(e,"P",{"data-svelte-h":!0}),m(N)!=="svelte-18cmjd7"&&(N.textContent=ke),ce=s(e),F=u(e,"UL",{"data-svelte-h":!0}),m(F)!=="svelte-1iexpdh"&&(F.innerHTML=Ae),fe=s(e),G=u(e,"P",{"data-svelte-h":!0}),m(G)!=="svelte-fl6ys6"&&(G.innerHTML=Le),de=s(e),f(Y.$$.fragment,e),he=s(e),X=u(e,"P",{}),je(X).forEach(n),this.h()},h(){Ie(l,"name","hf:doc:metadata"),Ie(l,"content",Je)},m(e,t){Xe(document.head,l),i(e,o,t),i(e,p,t),i(e,Z,t),d(_,e,t),i(e,O,t),i(e,x,t),i(e,R,t),i(e,T,t),i(e,W,t),i(e,C,t),i(e,D,t),d(y,e,t),i(e,J,t),d(z,e,t),i(e,K,t),i(e,P,t),i(e,Q,t),i(e,q,t),i(e,V,t),d(v,e,t),i(e,ee,t),d(S,e,t),i(e,te,t),i(e,H,t),i(e,ne,t),d(b,e,t),i(e,ie,t),d(k,e,t),i(e,ae,t),i(e,A,t),i(e,se,t),d(L,e,t),i(e,le,t),i(e,M,t),i(e,oe,t),i(e,E,t),i(e,re,t),i(e,U,t),i(e,ue,t),i(e,j,t),i(e,me,t),d(I,e,t),i(e,pe,t),i(e,N,t),i(e,ce,t),i(e,F,t),i(e,fe,t),i(e,G,t),i(e,de,t),d(Y,e,t),i(e,he,t),i(e,X,t),ge=!0},p(e,[t]){const Me={};t&2&&(Me.$$scope={dirty:t,ctx:e}),y.$set(Me);const Ee={};t&2&&(Ee.$$scope={dirty:t,ctx:e}),v.$set(Ee);const Ue={};t&2&&(Ue.$$scope={dirty:t,ctx:e}),b.$set(Ue)},i(e){ge||(h(_.$$.fragment,e),h(y.$$.fragment,e),h(z.$$.fragment,e),h(v.$$.fragment,e),h(S.$$.fragment,e),h(b.$$.fragment,e),h(k.$$.fragment,e),h(L.$$.fragment,e),h(I.$$.fragment,e),h(Y.$$.fragment,e),ge=!0)},o(e){g(_.$$.fragment,e),g(y.$$.fragment,e),g(z.$$.fragment,e),g(v.$$.fragment,e),g(S.$$.fragment,e),g(b.$$.fragment,e),g(k.$$.fragment,e),g(L.$$.fragment,e),g(I.$$.fragment,e),g(Y.$$.fragment,e),ge=!1},d(e){e&&(n(o),n(p),n(Z),n(O),n(x),n(R),n(T),n(W),n(C),n(D),n(J),n(K),n(P),n(Q),n(q),n(V),n(ee),n(te),n(H),n(ne),n(ie),n(ae),n(A),n(se),n(le),n(M),n(oe),n(E),n(re),n(U),n(ue),n(j),n(me),n(pe),n(N),n(ce),n(F),n(fe),n(G),n(de),n(he),n(X)),n(l),$(_,e),$(y,e),$(z,e),$(v,e),$(S,e),$(b,e),$(k,e),$(L,e),$(I,e),$(Y,e)}}}const Je='{"title":"Autoscaling","local":"autoscaling","sections":[{"title":"Scale to Zero","local":"scale-to-zero","sections":[],"depth":2},{"title":"Number of replicas","local":"number-of-replicas","sections":[],"depth":2},{"title":"Autoscaling Strategy","local":"autoscaling-strategy","sections":[{"title":"Scaling based on hardware utilization","local":"scaling-based-on-hardware-utilization","sections":[],"depth":3},{"title":"Scaling based on pending requests","local":"scaling-based-on-pending-requests","sections":[],"depth":3}],"depth":2}],"depth":1}';function Ke(w){return Fe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class nt extends Ge{constructor(l){super(),Ye(this,l,Ke,De,Ne,{})}}export{nt as component};
