Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assume that the student is using the Free Tier of Cosmos DB #62

Open
gregoryagu opened this issue Nov 25, 2024 · 0 comments
Open

Assume that the student is using the Free Tier of Cosmos DB #62

gregoryagu opened this issue Nov 25, 2024 · 0 comments

Comments

@gregoryagu
Copy link

Module: 420

Lab/Demo: 16/17

Description of issue

The typical student doing this lab is going to be using the Free Tier of Cosmos DB. This allows him to use up with 1000 RUs for free.

However, if this is the case, the lab will not run, as each container consumes 400 provisioned throughput , so only the first database is created, and the first two containers and it then fails.

Repro steps: Run the lab using the Free Tier of Cosmos DB.

Here is how I resolved this:

Line 760:
string folder = "data" + Path.DirectorySeparatorChar + databaseName;
var throughputProperties = ThroughputProperties.CreateManualThroughput(1000);
Database database = await client.CreateDatabaseIfNotExistsAsync(databaseName, throughputProperties);

This will allow all containers to share the same 1000 RS's, and the code will not error out.

Line 772: Do not set a throughput on the container, as it inherits this from the Database:
//ContainerProperties containerProperties = new ContainerProperties(containerName, "/id");
Container container = await database.CreateContainerIfNotExistsAsync(containerName, "/id");
// containerProperties: containerProperties,
// throughputProperties: ThroughputProperties.CreateAutoscaleThroughput(autoscaleMaxThroughput: 4000)
//);

However, you can still only create one database at a time. When I did the labs, I created version 1 did the labs for it, and then deleted it again and created database-v2 and so on. Not sure how else to approach this.

Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant