sourcify icon indicating copy to clipboard operation
sourcify copied to clipboard

Researching the queueing/ticketing system in the GCP context and in Cloud Run Services

Open marcocastignoli opened this issue 6 months ago • 7 comments

Context

  • Sourcify server struggles when many requests are incoming, it doesn't have any scaling strategy.
  • Sourcify server currently have one pending HTTP request for each pending verification, /verify HTTP requests are closed only when verification is completed. With #1367 we want to introduce e receipt property in /v2/verify response, this will allow to separate HTTP request from the verification status.

Solutions

We are exploring two solutions:

  • One that uses a queuing system between two new services: sourcify-http-server and sourcify-verification-service. sourcify-http-server will push pending contracts to the queue-service and sourcify-verification-service will read pending contracts from queue-service verifying them and marking them as completed. This solution involves setting up a queue service adding more complexity to our architecture, but we have granular control on what's in the queue, enabling us to potentially implement priority systems.
graph TD
    User -->|/verify| sourcify-http-server
    sourcify-http-server -->|Push Pending Contracts| queue-service
    queue-service -->|Read Pending Contracts| sourcify-verification-service
    sourcify-verification-service -->|Mark as Completed| sourcify-database
    sourcify-http-server -->|Read Status| sourcify-database
    sourcify-http-server -->|Read Status| queue-service
  • The second solution doesn't use a queue service, but it takes advantage of the scaling solutions offered by GCP. Two new services sourcify-http-server and sourcify-verification-service will be deployed as Google Cloud Run Services, sourcify-http-server will receive /verify request from the internet and call sourcify-verification-service directly without passing through a queue. The verification's status is going to be saved in sourcify-database
graph TD
    User -->|/public_api_verify| sourcify-http-server
    sourcify-http-server -->|/internal_api_verify| sourcify-verification-service
    sourcify-verification-service -->|Write Status| sourcify-database
    sourcify-http-server -->|Read Status| sourcify-database

marcocastignoli avatar Aug 08 '24 09:08 marcocastignoli