Example project showcasing a resilient multi-region app on SAP BTP powered by globally distributed Azure Cosmos DB. App was built upon the SAP Developer tutorial Create a Node.js Application via Cloud Foundry Command Line Interface and the SAP Private Link for Cosmos DB. It relies on Fastify instead of Express for a leaner setup.
This repos and associated 📝blog post shed light on the private connectivity aspect. To complete your resiliency journey, have a look at intelligent routing in this joint Microsoft+SAP Discovery Center mission and this blog post.
Create SampleDB
from Quick Launch wizard in Cosmos DB on the Azure portal.
Create a SAP Private Link for Cosmos DB named cosmos-pls or rename service in manifest.yml
Run SAP Business Application Stuido or compatible IDE of your choice (I like GitHub Codespaces for ready to run environments).
git clone https://github.com/MartinPankraz/sap-nodejs-on-cosmosdb-app.git
cp templates/.env app
Maintain your cosmos credentials in the .env
file. From Cosmos DB UI navigate to Settings -> Keys -> read-write Keys -> Primary Key.
cd app
npm install
npm start
Navigate to the addresses tab and enjoy the private response from Cosmos🪐☄️
Warning - when executing locally you need a connection to your SAP Private Link service (remember Cosmos is not publicly reachable!). Have a look here how to use ssh with cf.
Adjust route in manifest.yml as per SAP's recommendation in step 2.
cf push
This repos sheds light on the private connectivity aspect only. Learn more about intelligent routing in this joint Microsoft+SAP Discovery Center mission and this blog post.
Above architecture can be considered a mix of high-availability and failover concepts. How so? The SAP Private Link in each BTP CloudFoundry space is configured to be able to reach both Cosmos regions and the app layer responds to the end-user as per the intelligent routing setting (fastest, closest etc.).
Learn more about Azure IoT and Cosmos DB here.
Consider the ABAP SDK for Azure for additional interaction scenarios with Cosmos DB.
Note - Primary purpose of this Database comparison is to fuel your own investigation with no ambition to be extensive.
Lear more about choosing an API for Azure Cosmos DB here.
Database | Type | SAP Private Link enabled | Hosted on BTP/customer’s Azure env | Supported by SAP CAP natively |
---|---|---|---|---|
HANA Cloud | Managed, closed-source, in-memory db service for relational, graph, spatial and document structures | Not yet | Yes/No | Yes |
PostgreSQL, hyperscaler option | Managed, open-source object-relational db service | No, but private VNet integration instead | Yes/No | No -- community offering hosted by SAP Mentors |
Redis, hyperscaler option | Managed, open-source in-memory data store for caching, streaming and message broker | No -- private VNet integration instead | Yes/No | No |
Azure Database for MySQL - single server1 | Managed, open-source, traditional relational db | yes | No/Yes | No -- community offering by Theo Sun |
Azure Database for Maria DB1 | Managed, open-source, traditional relational db | yes | No/Yes | No -- community offering by Theo Sun |
Azure Cosmos DB (serverless)2 | Managed, closed source, NoSQL and relational database for modern app development, highly responsive, globally distributed | yes | No/Yes | No, but in discussion with SAP Mentors and community |
Azure Cosmos DB (provisioned throughput)2 | See line before | yes | No/Yes | No, but in discussion with SAP Mentors and community |
Azure Cosmos DB for PostgreSQL | Managed service for PostgreSQL extended with the Citus open source superpower of distributed tables | Not yet | No/Yes | No, conflicts with PostgreSQL, hyperscaler option |
Azure Cosmos DB for MongoDB3 | Managed, MongoDB API compliant flavour of Cosmos | yes | No/Yes | No |
Azure Cosmos DB for Apache Cassandra3 | Managed, Cassandra API compliant flavour of Cosmos | yes | No/Yes | No |
Azure Cosmos DB for Apache Gremlin3 | Managed, Gremlin API compliant flavour of Cosmos, massive graph database service | yes | No/Yes | No |
1 General Purpose, Gen5 2 vCore
2 Request Units need to be understood for a proper comparison. Also paritioning strategy impacting number of requests.
Note: Check the SAP Estimator and Azure Pricing Calculator to get a ballpark overview on pricing details.
As you can see there is a variety of choice of data bases for your BTP app with different capabilities and implications. The associated blog post and prototype use Azure Cosmos DB for NoSQL in a multi-region setup with provisioned throughput.
Follow this thread to stay up to date with CDS for Azure CosmosDB and SAP CAP driven by the amazing SAP Mentors. Feel free to comment under the associated blog posts or create issues here on GitHub.