Is Cloud Firestore a good alternative to CDN? - database

In the docs, they claims that Cloud Firestore duplicates data in multiple servers located in different regions across the world.
My question is : By using Cloud Firestore, do i need to cache my data even though ?

Firestore is a document-based storage system. It's typically used as a database for your app, so for content that changes more regularly.
A CDN is a caching layer for delivering (mostly) static assets to regionally diverse users. I'd recommend looking at Cloud Storage for Firebase for that.

Cloud Firestore synchronously replicates data for durability and availability, rather than for serving speed. In this sense, it is very different from a CDN or a latency cache.
The Mobile and Web SDKs do store data locally though and provide a concept called latency compensation, so on that side it's got you covered out of the box.

Related

Create a CDN with Google Cloud and Image Optimization

I have many websites and also websites made by clients which I would like to optimize. I am currently using different CDN providers but I would like to simplify my workflow and hopefully also lower the costs.
I would like to have a CDN with a Pull Zone, and that CDN would also optimize the images (while not modifying the other static resources).
Ideally, I would also have access to statistics for each Pull Zone (since I would like to charge my clients for this service instead of guessing).
What are the different ways to do this with the Google Cloud? Is there a way to do this only using Google Functions, CDN, and Google Storage? Of course, I guess that having a little NodeJS app running to optimize the images would be needed as well. I just wonder about the general architecture and if it is even possible (I know it is with Azure and AWS but I am already running a few things on the Google Cloud).
Thanks a lot :)
In GCP a pull zone can be created by associating a HTTP(S) Load Balancer to a Cloud Storage Bucket and enabling Cloud CDN.
Having a different bucket for every client will break down the logs on your project, but not the billing for it.
To be able to separate billing you can always export the logs to a BigQuery and use it to break down the billing costs per client based on their use.
Regarding the optimization of the images, Google CDN will not perform any operation, neither GCS Bucket.
The only operation available in this direction is when using and serving GZip-compressed files.
I suggest you to dedicate one Instance to be able to prepare the images before storing or to add/replace the optimized versions of the images already inside the bucket.

Google Cloud Datastore vs Cloud SQL

I am building a mobile app with Google Cloud as back-end. It stores information about restaurants including their menu. I would need to search based on the menu items and geo location.
I am fairly confused about which Google Cloud solutions to use. Initially I have planned to use Google App Engine with Cloud Datastore for storing data, but later found out, it doesn't support geolocation search, and even if I use the App Engine search api, I won't get 'like' text search. About using cloud SQL, I am worried about its price. I am also thinking about using Google Compute Engine and installing required MongoDB or SQL in it and use some custom search libraries.
So my question is which of the below should be an feasible and economical solution for storing large amount of data and searching using text and geo-location
GAE with Cloud Datastore
GAE with Cloud SQL
GCE with MongoDB or SQL installed
Any other feasible solutions are also welcome
Google has a page to give high-level guidance on what storage option to choose on GCP, called Choosing a storage option.
Specifically for Cloud Datastore:
Description: A scalable, fully-managed NoSQL document database for your web and mobile applications.
Good for:
Semi-structured application data
Hierarchical data
Durable key-value
Common Workloads:
User profiles
Product catalogs
Game state
Specifically for Cloud SQL:
Description: A fully-managed MySQL database service that is built on the strength and reliability of Google’s infrastructure.
Good for:
Web-frameworks
Structured data
OLTP workloads
Common Workloads:
Websites, blogs, and content management systems (CMS)
Business Intelligence (BI) applications
ERP, CRM, and eCommerce applications
As you can see, your use case could border either option. Restaurants + Menus is very similar to product catalogs.
Cloud Datastore would require less ops work/thoughts on your side. For example, you don't need to think about what type of VM instance and memory size it should use. However, to do analytics on data rather than just serving the menus, you'd probably want to do daily dumps into BigQuery.
Cloud SQL will require a little more thought at the beginning, and at small sizes will be a little more expensive than Cloud Datastore. It does give you more flexibility on the analytics side in that it doesn't really need you to dump into BigQuery.
Running a different database on GCE is certainly an option if you want more control. The trade-off here will be in requiring much more active ops work on your behalf, such as installing, patching, tuning, etc.

What is the benefit of using google cloud storage instead of google cloud sql for saving files

So what makes google cloud storage preferred choice for saving files. As I know google cloud storage is saving the file as blob so it is immutable and cannot be edited.
if the main aspect of your website/application is a database (as is often the case), check out Google Cloud SQL. Again it allows you to host your MySQL database on Google’s infrastructure, increasing the speed, reliability and security.
Whereas Google Cloud Storage enables application developers to store their data on Google’s infrastructure with very high reliability, performance and availability, and can be used to distribute large data objects to users via direct download.

NoSQL, jquery, scalable database cloud service for HTML/CSS/JS phonegap web app

I am developing a web app (HTML/CSS/JS) destined to be used as is and also compiled with phonegap for iOS/Android/and others. I am loging my users using OpenId Connect.
I am looking for a database hosting service. It should be NoSQL, readable/writable by jquery and scalable.
I need to store the user's contact info and other user choices from my app.
I am thinking about using Cloudant with a CouchDb database, but I am really new to this.
Can you help me ?
Thanks
If you would like to use Amazon Web Services, take a look at Dynamo DB. It is infinitely scalable. You can start for almost free and pay more as and when your data-size and request load increases. It can guarantee you the same low response time even with huge data.
You can use this from JS as well
I have discussed some other options in this other SO thread - Parse, Firebase, Dropbox DataStore etc. Have a look: Storing and retrieving data in the cloud and retrieving via webservices:

How do people create restful data services in Google App Engine?

Where do developers store their data? I heard that it can be hard to access S3 with the existing libraries and you need to update all URL calls using GAE's methods. Do developers typically find other ways to access S3 or do they use some other sort of storage (Google Storage is not public yet) such as databases? Does google provide anything for this, what is the "ideal" way that app engine would solve the problem of having users get and post data to persistent storage through app engine?
GAE provides the Datastore API, built on their Bigtable.
There's many good questions on the GAE Datastore here on stackoverflow.

Resources