Design feasibility

62 views
Skip to first unread message

Niall McCarthy

unread,
Jan 13, 2020, 7:51:01 AM1/13/20
to Google App Engine
I am new to server-less development and I have a question about the feasibility of a design and wondering if anyone had any starter tips.

My application works as follows:

I want to provide a single instance per user with a unique db per user. The difficulty for me arises from the fact that the instances and DB's need to be volatile.

When the user lands on an appengines instance the web-app on the instance will need to initiate a db and fetch and load a set of text files into the db for this user.
When the user disconnects the instance/files and db need to all be dropped.

Does the above setup make sense under app-engine ?

Olu

unread,
Jan 13, 2020, 12:57:55 PM1/13/20
to Google App Engine
On App Engine, there is no way to restrict specific Instance to particular Users. Instances are spun up based on configurations on the Application's App.yaml file[1][2]. Also, depending on the Scaling Options, it is possible to scale App Engine Standard applications[3] to Zero Instances whenever there are no incoming requests to be handled. I believe this would simulate your design to scale to zero whenever your user disconnects, however, the scaling would only scale to zero based on availability(or unavailability) of incoming requests, rather than the connection or disconnection from a specific User. 

Also, App Engine applications can connect with CloudSQL Instances(if you plan to have a relational DB) and you can choose to create databases within a single Cloud SQL Instance, however, these Databases could not be shut down in response to connection or disconnection from a specific User[4]. 

Niall McCarthy

unread,
Jan 14, 2020, 11:19:28 AM1/14/20
to Google App Engine
Thank you so much for your response. Just to clarify the way I am trying to implement this solution is as follows I have a system with 1 million user base.
I am expecting a couple of hundred users to connect at any one time. When the user connects to an instance I was hoping to payload into the http request
some user id information.

I would then spin up a DB and download/import data from an external 3rd party storage into the db, the user would then have access to that data for the duration of the instance.
I was hoping I could create an empty sql instance as a primary and then clone it and use it for the appengine instance for the user session.

Once the user becomes inactive/times out I would delete the cloned db instance.

Aref Amiri (Cloud Platform Support)

unread,
Jan 15, 2020, 9:21:08 AM1/15/20
to Google App Engine
App Engine instances are scaled based on the incoming requests and therefore it is not possible to assign them the user ID. This can be reported as a Feature Request and I would suggest posting it on the Public Issue Tracker so that the engineering team could review it for future implementation.
 
For system architecture, you may be better served in dedicated forums such as Stackoverflow, where experienced programmers are within reach and ready to help to propose solutions in accomplishing such tasks.
Reply all
Reply to author
Forward
0 new messages