Using Firebase Cloud Functions for SSR without Cold Starts possible? [duplicate]











up vote
0
down vote

favorite













This question already has an answer here:




  • How can I keep Google Cloud Functions warm?

    2 answers




So I know that Cold Starts are a thing due to the whole architecture and that is fine, so I wanna host my SSR Website on the Hosting and make it SSR via the Cloud Functions which is possible as seen in endless examples when googling.



One thing I wanna prevent is having Cold Starts happen even if the page has a consistent traffic, in theory if the Page has a consistent traffic so that the Render Function is executed on a frequent basis there should be no cold Starts or do you I need to keep something else in mind?



I dont wann have long Page load times happen too often.










share|improve this question













marked as duplicate by Doug Stevenson firebase
Users with the  firebase badge can single-handedly close firebase questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 13 at 16:51


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • @DougStevenson not even the same
    – Badgy
    Nov 13 at 16:59










  • Please explain. The dup is saying that you can't eliminate cold starts, which is what it seems you are asking here.
    – Doug Stevenson
    Nov 13 at 17:01















up vote
0
down vote

favorite













This question already has an answer here:




  • How can I keep Google Cloud Functions warm?

    2 answers




So I know that Cold Starts are a thing due to the whole architecture and that is fine, so I wanna host my SSR Website on the Hosting and make it SSR via the Cloud Functions which is possible as seen in endless examples when googling.



One thing I wanna prevent is having Cold Starts happen even if the page has a consistent traffic, in theory if the Page has a consistent traffic so that the Render Function is executed on a frequent basis there should be no cold Starts or do you I need to keep something else in mind?



I dont wann have long Page load times happen too often.










share|improve this question













marked as duplicate by Doug Stevenson firebase
Users with the  firebase badge can single-handedly close firebase questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 13 at 16:51


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • @DougStevenson not even the same
    – Badgy
    Nov 13 at 16:59










  • Please explain. The dup is saying that you can't eliminate cold starts, which is what it seems you are asking here.
    – Doug Stevenson
    Nov 13 at 17:01













up vote
0
down vote

favorite









up vote
0
down vote

favorite












This question already has an answer here:




  • How can I keep Google Cloud Functions warm?

    2 answers




So I know that Cold Starts are a thing due to the whole architecture and that is fine, so I wanna host my SSR Website on the Hosting and make it SSR via the Cloud Functions which is possible as seen in endless examples when googling.



One thing I wanna prevent is having Cold Starts happen even if the page has a consistent traffic, in theory if the Page has a consistent traffic so that the Render Function is executed on a frequent basis there should be no cold Starts or do you I need to keep something else in mind?



I dont wann have long Page load times happen too often.










share|improve this question














This question already has an answer here:




  • How can I keep Google Cloud Functions warm?

    2 answers




So I know that Cold Starts are a thing due to the whole architecture and that is fine, so I wanna host my SSR Website on the Hosting and make it SSR via the Cloud Functions which is possible as seen in endless examples when googling.



One thing I wanna prevent is having Cold Starts happen even if the page has a consistent traffic, in theory if the Page has a consistent traffic so that the Render Function is executed on a frequent basis there should be no cold Starts or do you I need to keep something else in mind?



I dont wann have long Page load times happen too often.





This question already has an answer here:




  • How can I keep Google Cloud Functions warm?

    2 answers








firebase google-cloud-platform google-cloud-functions






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 13 at 12:04









Badgy

904320




904320




marked as duplicate by Doug Stevenson firebase
Users with the  firebase badge can single-handedly close firebase questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 13 at 16:51


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by Doug Stevenson firebase
Users with the  firebase badge can single-handedly close firebase questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 13 at 16:51


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • @DougStevenson not even the same
    – Badgy
    Nov 13 at 16:59










  • Please explain. The dup is saying that you can't eliminate cold starts, which is what it seems you are asking here.
    – Doug Stevenson
    Nov 13 at 17:01


















  • @DougStevenson not even the same
    – Badgy
    Nov 13 at 16:59










  • Please explain. The dup is saying that you can't eliminate cold starts, which is what it seems you are asking here.
    – Doug Stevenson
    Nov 13 at 17:01
















@DougStevenson not even the same
– Badgy
Nov 13 at 16:59




@DougStevenson not even the same
– Badgy
Nov 13 at 16:59












Please explain. The dup is saying that you can't eliminate cold starts, which is what it seems you are asking here.
– Doug Stevenson
Nov 13 at 17:01




Please explain. The dup is saying that you can't eliminate cold starts, which is what it seems you are asking here.
– Doug Stevenson
Nov 13 at 17:01












1 Answer
1






active

oldest

votes

















up vote
0
down vote













Thats correct, as long as it has consistent traffic you shouldn't run into cold start issues. There is always a possiblity with serverless architecture that it could go away but as long as its consistently being hit it shouldnt suffer a cold start issue. If you are running on Firebase Hosting using a Cloud function to do the SSR you could also leverage the firebase cdn to store it and therefore not needing to do the SSR each time.



Link to Connect to functions and lower down the page explains the cache control. You can put it in the cache for as long as you need. I have used it in the past to preload the cache on specific pages and that way they are ready when needed and if needs be it can fall back to the SSR.






share|improve this answer





















  • Oh thanks for that Info I will try to implement that
    – Badgy
    Nov 13 at 13:09










  • A other question idk if you got experience in such a case but since its a blog so a new post would only appear like 1-2 times a day would it be an option to let the post once in the firestore trigger a function which prerenders a related page, this way i could use a lot less function triggers while having the SEO optimization of SSR, or am i overlooking something?
    – Badgy
    Nov 13 at 13:18












  • Thats what I would suggest. I have setup similar things where firestore triggers will for onUpdate purge a page from the cache and then issue to the web request which will put it into the CDN and onCreate just issue the web request and put it into the CDN. To purge instead of doing a get to the page the method is purge. Its not an official method in the API yet but was mentioned in a talk once.
    – Jack Woodward
    Nov 13 at 14:10










  • Okay, I will write some code and I would appreciate it if you could look over the Functions File once im done with it i have no experience in the Functions yet and im scared that I do mistakes that lower efficiency and cost more
    – Badgy
    Nov 13 at 15:22






  • 1




    You can't fully eliminate cold starts, as Cloud Functions may always spin up a new server instance to handle increasing load. That new instance will have a cold start. All you can do is make the problem less bad, but you can't eliminate it without having your own servers running 24/7.
    – Doug Stevenson
    Nov 13 at 16:56


















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













Thats correct, as long as it has consistent traffic you shouldn't run into cold start issues. There is always a possiblity with serverless architecture that it could go away but as long as its consistently being hit it shouldnt suffer a cold start issue. If you are running on Firebase Hosting using a Cloud function to do the SSR you could also leverage the firebase cdn to store it and therefore not needing to do the SSR each time.



Link to Connect to functions and lower down the page explains the cache control. You can put it in the cache for as long as you need. I have used it in the past to preload the cache on specific pages and that way they are ready when needed and if needs be it can fall back to the SSR.






share|improve this answer





















  • Oh thanks for that Info I will try to implement that
    – Badgy
    Nov 13 at 13:09










  • A other question idk if you got experience in such a case but since its a blog so a new post would only appear like 1-2 times a day would it be an option to let the post once in the firestore trigger a function which prerenders a related page, this way i could use a lot less function triggers while having the SEO optimization of SSR, or am i overlooking something?
    – Badgy
    Nov 13 at 13:18












  • Thats what I would suggest. I have setup similar things where firestore triggers will for onUpdate purge a page from the cache and then issue to the web request which will put it into the CDN and onCreate just issue the web request and put it into the CDN. To purge instead of doing a get to the page the method is purge. Its not an official method in the API yet but was mentioned in a talk once.
    – Jack Woodward
    Nov 13 at 14:10










  • Okay, I will write some code and I would appreciate it if you could look over the Functions File once im done with it i have no experience in the Functions yet and im scared that I do mistakes that lower efficiency and cost more
    – Badgy
    Nov 13 at 15:22






  • 1




    You can't fully eliminate cold starts, as Cloud Functions may always spin up a new server instance to handle increasing load. That new instance will have a cold start. All you can do is make the problem less bad, but you can't eliminate it without having your own servers running 24/7.
    – Doug Stevenson
    Nov 13 at 16:56















up vote
0
down vote













Thats correct, as long as it has consistent traffic you shouldn't run into cold start issues. There is always a possiblity with serverless architecture that it could go away but as long as its consistently being hit it shouldnt suffer a cold start issue. If you are running on Firebase Hosting using a Cloud function to do the SSR you could also leverage the firebase cdn to store it and therefore not needing to do the SSR each time.



Link to Connect to functions and lower down the page explains the cache control. You can put it in the cache for as long as you need. I have used it in the past to preload the cache on specific pages and that way they are ready when needed and if needs be it can fall back to the SSR.






share|improve this answer





















  • Oh thanks for that Info I will try to implement that
    – Badgy
    Nov 13 at 13:09










  • A other question idk if you got experience in such a case but since its a blog so a new post would only appear like 1-2 times a day would it be an option to let the post once in the firestore trigger a function which prerenders a related page, this way i could use a lot less function triggers while having the SEO optimization of SSR, or am i overlooking something?
    – Badgy
    Nov 13 at 13:18












  • Thats what I would suggest. I have setup similar things where firestore triggers will for onUpdate purge a page from the cache and then issue to the web request which will put it into the CDN and onCreate just issue the web request and put it into the CDN. To purge instead of doing a get to the page the method is purge. Its not an official method in the API yet but was mentioned in a talk once.
    – Jack Woodward
    Nov 13 at 14:10










  • Okay, I will write some code and I would appreciate it if you could look over the Functions File once im done with it i have no experience in the Functions yet and im scared that I do mistakes that lower efficiency and cost more
    – Badgy
    Nov 13 at 15:22






  • 1




    You can't fully eliminate cold starts, as Cloud Functions may always spin up a new server instance to handle increasing load. That new instance will have a cold start. All you can do is make the problem less bad, but you can't eliminate it without having your own servers running 24/7.
    – Doug Stevenson
    Nov 13 at 16:56













up vote
0
down vote










up vote
0
down vote









Thats correct, as long as it has consistent traffic you shouldn't run into cold start issues. There is always a possiblity with serverless architecture that it could go away but as long as its consistently being hit it shouldnt suffer a cold start issue. If you are running on Firebase Hosting using a Cloud function to do the SSR you could also leverage the firebase cdn to store it and therefore not needing to do the SSR each time.



Link to Connect to functions and lower down the page explains the cache control. You can put it in the cache for as long as you need. I have used it in the past to preload the cache on specific pages and that way they are ready when needed and if needs be it can fall back to the SSR.






share|improve this answer












Thats correct, as long as it has consistent traffic you shouldn't run into cold start issues. There is always a possiblity with serverless architecture that it could go away but as long as its consistently being hit it shouldnt suffer a cold start issue. If you are running on Firebase Hosting using a Cloud function to do the SSR you could also leverage the firebase cdn to store it and therefore not needing to do the SSR each time.



Link to Connect to functions and lower down the page explains the cache control. You can put it in the cache for as long as you need. I have used it in the past to preload the cache on specific pages and that way they are ready when needed and if needs be it can fall back to the SSR.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 13 at 13:03









Jack Woodward

49128




49128












  • Oh thanks for that Info I will try to implement that
    – Badgy
    Nov 13 at 13:09










  • A other question idk if you got experience in such a case but since its a blog so a new post would only appear like 1-2 times a day would it be an option to let the post once in the firestore trigger a function which prerenders a related page, this way i could use a lot less function triggers while having the SEO optimization of SSR, or am i overlooking something?
    – Badgy
    Nov 13 at 13:18












  • Thats what I would suggest. I have setup similar things where firestore triggers will for onUpdate purge a page from the cache and then issue to the web request which will put it into the CDN and onCreate just issue the web request and put it into the CDN. To purge instead of doing a get to the page the method is purge. Its not an official method in the API yet but was mentioned in a talk once.
    – Jack Woodward
    Nov 13 at 14:10










  • Okay, I will write some code and I would appreciate it if you could look over the Functions File once im done with it i have no experience in the Functions yet and im scared that I do mistakes that lower efficiency and cost more
    – Badgy
    Nov 13 at 15:22






  • 1




    You can't fully eliminate cold starts, as Cloud Functions may always spin up a new server instance to handle increasing load. That new instance will have a cold start. All you can do is make the problem less bad, but you can't eliminate it without having your own servers running 24/7.
    – Doug Stevenson
    Nov 13 at 16:56


















  • Oh thanks for that Info I will try to implement that
    – Badgy
    Nov 13 at 13:09










  • A other question idk if you got experience in such a case but since its a blog so a new post would only appear like 1-2 times a day would it be an option to let the post once in the firestore trigger a function which prerenders a related page, this way i could use a lot less function triggers while having the SEO optimization of SSR, or am i overlooking something?
    – Badgy
    Nov 13 at 13:18












  • Thats what I would suggest. I have setup similar things where firestore triggers will for onUpdate purge a page from the cache and then issue to the web request which will put it into the CDN and onCreate just issue the web request and put it into the CDN. To purge instead of doing a get to the page the method is purge. Its not an official method in the API yet but was mentioned in a talk once.
    – Jack Woodward
    Nov 13 at 14:10










  • Okay, I will write some code and I would appreciate it if you could look over the Functions File once im done with it i have no experience in the Functions yet and im scared that I do mistakes that lower efficiency and cost more
    – Badgy
    Nov 13 at 15:22






  • 1




    You can't fully eliminate cold starts, as Cloud Functions may always spin up a new server instance to handle increasing load. That new instance will have a cold start. All you can do is make the problem less bad, but you can't eliminate it without having your own servers running 24/7.
    – Doug Stevenson
    Nov 13 at 16:56
















Oh thanks for that Info I will try to implement that
– Badgy
Nov 13 at 13:09




Oh thanks for that Info I will try to implement that
– Badgy
Nov 13 at 13:09












A other question idk if you got experience in such a case but since its a blog so a new post would only appear like 1-2 times a day would it be an option to let the post once in the firestore trigger a function which prerenders a related page, this way i could use a lot less function triggers while having the SEO optimization of SSR, or am i overlooking something?
– Badgy
Nov 13 at 13:18






A other question idk if you got experience in such a case but since its a blog so a new post would only appear like 1-2 times a day would it be an option to let the post once in the firestore trigger a function which prerenders a related page, this way i could use a lot less function triggers while having the SEO optimization of SSR, or am i overlooking something?
– Badgy
Nov 13 at 13:18














Thats what I would suggest. I have setup similar things where firestore triggers will for onUpdate purge a page from the cache and then issue to the web request which will put it into the CDN and onCreate just issue the web request and put it into the CDN. To purge instead of doing a get to the page the method is purge. Its not an official method in the API yet but was mentioned in a talk once.
– Jack Woodward
Nov 13 at 14:10




Thats what I would suggest. I have setup similar things where firestore triggers will for onUpdate purge a page from the cache and then issue to the web request which will put it into the CDN and onCreate just issue the web request and put it into the CDN. To purge instead of doing a get to the page the method is purge. Its not an official method in the API yet but was mentioned in a talk once.
– Jack Woodward
Nov 13 at 14:10












Okay, I will write some code and I would appreciate it if you could look over the Functions File once im done with it i have no experience in the Functions yet and im scared that I do mistakes that lower efficiency and cost more
– Badgy
Nov 13 at 15:22




Okay, I will write some code and I would appreciate it if you could look over the Functions File once im done with it i have no experience in the Functions yet and im scared that I do mistakes that lower efficiency and cost more
– Badgy
Nov 13 at 15:22




1




1




You can't fully eliminate cold starts, as Cloud Functions may always spin up a new server instance to handle increasing load. That new instance will have a cold start. All you can do is make the problem less bad, but you can't eliminate it without having your own servers running 24/7.
– Doug Stevenson
Nov 13 at 16:56




You can't fully eliminate cold starts, as Cloud Functions may always spin up a new server instance to handle increasing load. That new instance will have a cold start. All you can do is make the problem less bad, but you can't eliminate it without having your own servers running 24/7.
– Doug Stevenson
Nov 13 at 16:56



Popular posts from this blog

How to change which sound is reproduced for terminal bell?

Can I use Tabulator js library in my java Spring + Thymeleaf project?

Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents