Moving to a micro-service architecture, I have separated an AppEngine 
module into two services (the big one and a smaller one, still part of the 
same AppEngine project).
  
Next, I want to separate the database into two, so allowing the small 
micro-service to have only the needed tables in its own db.  The problem is 
one of the tables is needed by both micro-services. The smaller service 
only reads data from this table (has multiple select queries which join on 
data from this table)

Option 1:
I can leave this table in the bigger service which uses it the most and 
make the smaller service make an http request to get the data that it 
needs, cache this data and be notified when this data changes by the owner 
service of that table. Then, to refresh its cache, the smaller service 
makes an http request again.

In order to communicate from service A to service B, I was thinking between 
using Google PubSub or Task Queue. And I am not sure which one to use here. 
In this case, receiving the message in order is not important since the 
message will be generic "table_state_changed, query for new data", so both 
could be used..

Option 2:
I can duplicate the table in both databases (this will allow the service to 
have all the necessary data closer).  When the bigger service modifies data 
in the table, it will notify the smaller service to perform the same 
modification on its version of the table. In this case, the order of the 
messages is important, since it specifies exact crud operations to perform 
on the table. 

Can PubSub be modified to maintain order, somehow insert ordering 
information in the message payload to contain previous messages sent? 
Retries are also important, we don't want to end up having inconsistencies 
between the two tables.

Option 3:
Is there a way to create Read Replicas with ignored tables in AppEngine (so 
that I include only the tables I need in one of the services and leave the 
other one with the entire db as it is currently) and set a specific service 
to only use that replica? This does not sound as a good idea, however it 
leaves CloudSql the burden of maintaining same data in both versions of the 
table).

Which option is better in your opinion and most importantly which one is 
better suited for this case? PubSub or TaskQueues. 
Also, this is only the first step to separate the monolith, there will be 
other services in the future, that would probably encounter the same 
problem.

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/fee2b32c-42ef-4ce6-a1fb-346ff01f4b73%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • [google-appengine... Roxana Ioana Roman
    • [google-appe... 'Alexey' via Google App Engine
      • [google-... 'Yannick (Cloud Platform Support)' via Google App Engine
        • [goo... Roxana Ioana Roman
          • ... 'Yannick (Cloud Platform Support)' via Google App Engine

Reply via email to