We've prepared an app based on firebase storage and we plan to run it with few events. They're will be like 70 000 people. We assume there will be not many different files to download - for example a few video files, some more photos and sounds.
Assuming firebase storage could download 200-300MB each person we want to optimize the network traffic in specific location (one building).
Is there any possibility to create/run local storage cache not to skyrocket firebase storage bandwith, but only do this in local area (for people connected to some ours network)? Download it once to some local server and redirect all requests to it?
I'm looking for any kind of a solution.
What you're asking for doesn't exactly exist within Firebase Storage.
However, you could work around your limitations by using a link to your content (e.g. on YouTube) and embedding it.
Alternatively, you could download content from your own server (or one hosted using Firebase Hosting) after you've pulled a list of metadata (links, names etc) from Firebase Storage. Using a CDN / caching service like Cloudflare would also mean that the impact on your server (or Firebase Hosting) is actually relatively low, as are costs.
Related
My website provides artists with an audio visualization of their uploaded mp3 files. Firebase Storage isn't necessarily the issue, but rather a bandwidth. Every time a fan accesses the website, the website downloads the mp3 from Firebase Storage in order to access the frequency data to visualize it. Given each mp3 is ~8MB, you could see how even having 200 fans accessing the website would go over the 1GB free quota, so having thousands of people viewing the website would become expensive and not scalable. I've considered hosting on SoundCloud, but I wouldn't be able to download the mp3 data in that case, only stream. What do people commonly do in this situation, where they need to have larger files like mp3s downloaded to display to the user without quickly running out of bandwidth?
Firebase Storage isn't necessarily the issue, but rather the bandwidth. Every time a fan accesses the website, the website downloads the mp3 from Firebase Storage in order to access the frequency data to visualize it.
So most likely, that's why you're having that problem related to the bandwidth because you're downloading all audio files, each time a user opens the website. That's not how you should handle this kind of situation. Instead of downloading all audio files, you should only display the name of the files, and only download them on demand. For example, you should store the name of the files and corresponding URLs from Cloud Storage, either in Cloud Firestore or in the Realtime Database, and as soon as the user clicks the download/play button, only then does start playing/downloading them.
Given each mp3 is ~8MB, you could see how even having 200 fans accessing the website would go over the 1GB free quota, so having thousands of people viewing the website would become expensive and not scalable.
The problem isn't about scalability, it's about costs. Cloud Storage for Firebase can easily scale to millions of files. Besides that, please also bear in mind that the free quota, it's used for testing puposes and not for real-world applications. For that scenario, you should consider upgrading to the Blaze Plan.
Is it possible to use Firebase as some sort of "middle end"? I have an app (front end) my users can use to share files with their friends. All the users data is saved in Firebase as a json. Right now the files that users share with each other are saved on Firebase Storage but as the size of data being saved and transferred grows, so do the server costs. I was therefore wondering if I can use Firebase just the way I am with the only exception that the files are being stored on another server (not Google/Firebase)? If that is possible, how could I do so, I have not found any kind of instruction online.
I have seen that Google Firebase offers a static files hosting solution (for the front end) which is served in SSL and by CDN. That means, I can serve customers all around the world with a server located probably close to them and enjoying good speeds.
Now I want to do the same with my Node.js backend code.
That means, instead of hosting my backend code in my own VPS, that will be probably fast only for who lives close to my server, I want to deploy the same server to Firebase's CDN and ofcourse, over HTTPS.
What I have found for now is the Firebase Functions which is probably a Node.js server. However I am not sure if its running uppon a CDN, so it will be fast just as the static files serving, or that its just a server located somewhere in US that has to serve worldwide.
In addition, if there is such a service - where I can host my back end code with SSL, may I have the "standard" express configuration I have now on my VPS?
And what for about clusters/workers? How many workers I can have when using the Firebase solution (if there is one like that).
Thanks.
SSL and firebase functions & hosting?
You get HTTPS by default for hosting and functions. If you need functions to served from your custom domain and not https://us-central1-[projectname].cloudfunctions.net, you will need to configure your firebase.json file to rewrite your routes to your firebase functions. The main thing to flag here is both options you get HTTPS and certs issues directly from google/firebase.
When you bring a custom domain over it can take up to 1-2 hours for firebase to issue the certificate, but all this happens automatically without you having to do anything.
Does firebase functions integrate with a CDN?
Yes, but you need to set the correct s-maxage header in your response to ensure the firebase CDN will store it. See here for more info on this.
Cache invalidation is still hard with firebase so I would keep this in mind before you set anything.
How many workers I can have when using the Firebase solution (if there is one like that).
One benefit of using firebase functions is that you don't need to really give much thought to the resources behind the backend. If you have heavier workloads you can increase your ram/ cpu power in the google console for your selected function. The endpoint will scale up and down depending on how many requests it gets. On the flip side if it doesn't get any requests (usually in non prod environments) it'll go to an idle state. You need to be aware of a cold start problem before you fully commit to using this as a replacement to your current nodejs VPs hosting solution.
I personally use the cache control headers to ensure the functions responses are pushed into the CDN edge, which takes the edge off the cold start issue (for me and my use case).
Which service is suitable according to my need?
I want to upload my videos to cloud so that anyone can watch those videos on my wordpress website but it must have some security measures like:
Anyhow, No one can download those videos .
Anyhow, no one can fetch links.
Downloader can't able to grab those videos.
There will be encryption technique for security purpose.
Like Amazon services and many more which one I should choose so that I can calculate exact price for that plan.
In Amazon services, I am not exactly getting the final prices for video encryption services.
Which is a better way to host multiple websites, all of them being static? Some are WordPress.
Should I create different buckets for all or host all on a single bucket itself? Please let me know how can I host it on a single bucket.
Following the official documentation for hosting a static website on Google Cloud Storage, you'll have to point a domain to the resource you want to serve, i.e www.example.com. You need to create a bucket with that name, so you'll need one bucket per domain.
Good thing is that you can create as many bucket as you want for no extra charge, as per Quotas & Limits.
Last thing I'd like to point out is that Wordpress actually isn't a static website. It's built in PHP which won't execute on Storage. There are plugins though that can generate a static website from your wordpress (or you could use App Engine Flexible).