Azure Cosmos - Mongodb - always reaching RUs limit?

default discord avatar
moonfabian
9 months ago
9

We want to deploy a payload instance with azure - but when registering or just saving a post - we're always reaching the RU limit for some reason




Error message:



Response status code does not indicate success: BadRequest (400); Substatus: 1028; ActivityId: ; Reason: (Message: {"Errors":["Your account is currently configured with a total throughput limit of 1600 RU\/s. This operation failed because it would have increased the total throughput to 2000 RU\/

  • discord user avatar
    denolfe
    Payload Team
    9 months ago

    Interesting. Do any other operations succeed? Are you performing any seeding on startup that would possibly be hitting your database? I'm not familiar with Azure's RU's. Would 2000 RU be a big jump over 1600?



    This could be an index thing as well. For Cosmos, you'll want to set

    indexSortableFields

    to true - try that out and see if it makes a difference.

    https://payloadcms.com/docs/configuration/overview#options
  • default discord avatar
    moonfabian
    9 months ago

    i actually switched to serverless cosmosdb - and now everything works pretty nice - i'll also post some screenshots - but it seems, that while creating the indexes - it got up to 2400 RUs - for a short time. - this would mean setting up cosmosdb for 2400RUs - about 200€/month & the problem is - that with cosmosdb - you cannot downsize the instance anymore.



    Maybe adding a notice to the docs would be good - or maybe in the future even optimising the setup

  • discord user avatar
    denolfe
    Payload Team
    9 months ago

    @dribbens Have you seen anything like this with clients running Cosmos?

  • discord user avatar
    dribbens
    Payload Team
    9 months ago

    Not too sure about existing setup costs. I wonder if cosmosDB is rebuild the indexes on a large collections on every startup? I would have to do some digging to find out. You could try setting

    autoIndex: false

    in your mongo options in the Payload config in production.

  • default discord avatar
    hades200082
    8 months ago

    What practical effect does

    autoIndex: false

    have on the CMS?

  • default discord avatar
    .corruptedmonk
    2 months ago

    yes, exactly the same problem for me too



    but the cosmos db api is timing our app service because of absurd amounts of RU's

  • discord user avatar
    denolfe
    Payload Team
    2 months ago

    For anyone stumbling upon this. The current workaround is to use serverless Cosmos DB. Issue tracked here:

    https://github.com/payloadcms/plugin-cloud-storage/issues/64
  • default discord avatar
    hades200082
    2 months ago

    That's not really a solution. That just means I'll get billed for the silly amount of RUs Payload is using rather than my app getting throttled.

  • discord user avatar
    denolfe
    Payload Team
    2 months ago

    Correct, I used the term workaround. The issue is open to look into a viable solution.

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.