Skip to content

performance optimization#139

Open
mrjmarcelo wants to merge 27 commits into
microsoft:mainfrom
mrjmarcelo:main
Open

performance optimization#139
mrjmarcelo wants to merge 27 commits into
microsoft:mainfrom
mrjmarcelo:main

Conversation

@mrjmarcelo

Copy link
Copy Markdown
Contributor

this includes changes mainly from @jeanmartins for performance optimization on events and tasks processing in durable task go.

mrjmarcelo and others added 24 commits May 23, 2025 15:45
- adapted Backend CreateTaskHub and DeleteTaskHub to call Start and Stop methods instead of directly manage backend database
…ods-implementation

- implemented Backend Start and Stop methods
…s not nil and handle error from Stop method if it happens
refactoring for sqliteBackend.DeleteTaskHub just to delete db if db is not nil and handle error from Stop method if it happens
Copilot AI review requested due to automatic review settings July 1, 2026 16:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Durable Task Go to use time-ordered UUIDv7s and applies a few Postgres-specific changes intended to improve throughput and query performance during orchestration event and activity task processing.

Changes:

  • Bumps github.com/google/uuid to v1.6.0 and switches multiple ID generation sites to UUIDv7.
  • Adds a Postgres index for Instances.ParentInstanceID and adjusts dequeue/locking queries.
  • Refactors Postgres orchestration work-item retrieval to reduce time spent inside the transaction (by unmarshalling after commit).

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
samples/parallel/parallel.go Uses UUIDv7 for sample device IDs.
internal/helpers/worker.go Prefers UUIDv7 for default worker name uniqueness.
internal/helpers/history.go Uses UUIDv7 for ExecutionId in execution-started events (with fallback).
go.mod Updates github.com/google/uuid to v1.6.0.
go.sum Adds v1.6.0 checksums for github.com/google/uuid.
client/client_grpc.go Uses UUIDv7 for autogenerated orchestration instance IDs.
backend/postgres/schema.sql Adds an index on Instances(ParentInstanceID).
backend/postgres/postgres.go Updates worker name UUID, changes dequeue ordering, and refactors orchestration work-item event handling/commit timing.
backend/client.go Uses UUIDv7 for autogenerated orchestration instance IDs.
Comments suppressed due to low confidence (1)

backend/client.go:53

  • This introduces a new failure mode (UUID generation can now fail the entire scheduling call). Previously this path always generated an ID; consider falling back to uuid.NewString() on error to preserve robustness while still preferring v7 when available.
		u, err := uuid.NewV7()
		if err != nil {
			return api.EmptyInstanceID, fmt.Errorf("failed to generate instance ID: %w", err)
		}
		req.InstanceId = u.String()

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread backend/postgres/postgres.go
Comment thread backend/postgres/postgres.go
Comment thread backend/postgres/postgres.go
Comment thread client/client_grpc.go Outdated
Comment thread samples/parallel/parallel.go
Comment thread internal/helpers/worker.go Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 1, 2026 16:31
@mrjmarcelo

Copy link
Copy Markdown
Contributor Author

@cgillum , please approve those changes for performance improvements

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.

Comment thread samples/parallel/parallel.go
Comment thread internal/helpers/worker.go Outdated
Comment thread backend/postgres/postgres.go
Comment thread backend/postgres/postgres.go
@cgillum

cgillum commented Jul 1, 2026

Copy link
Copy Markdown
Member

Hi @mrjmarcelo - thanks for opening up this PR. I've reviewed it briefly and I'm good with these changes in principle. I've triggered the CI automation just now. Please take a look at the Copilot generated comments and reply back once this is ready for a final human review.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 1, 2026 18:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.

Comment thread backend/postgres/postgres.go
Comment thread backend/postgres/postgres.go
Comment thread samples/parallel/parallel.go
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 1, 2026 19:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.

Comment on lines +864 to 867
evt, err := backend.UnmarshalHistoryEvent(e.payload)
if err != nil {
return nil, err
}
Comment on lines 832 to 833
defer events.Close()

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

Successfully merging this pull request may close these issues.

4 participants