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

Feat: Add min_containers to QueueDepthAutoscaler and instance controller for loading and reloading instances #846

Merged

Conversation

jsun-m
Copy link
Contributor

@jsun-m jsun-m commented Jan 10, 2025

Add min_containers field that allows users to set a the minimum amount of containers to keep warm when there is no activity.

Follow up:

  • Release worker
  • Release sdk
  • Release gateway

@jsun-m jsun-m changed the title Feat: Add min containers to QueueDepthAutoscaler Feat: Add min_containers to QueueDepthAutoscaler Jan 10, 2025
pkg/gateway/services/stub.go Show resolved Hide resolved
pkg/repository/backend_postgres.go Outdated Show resolved Hide resolved
pkg/api/v1/deployment.go Show resolved Hide resolved
pkg/abstractions/common/instance.go Outdated Show resolved Hide resolved
pkg/abstractions/common/instance.go Outdated Show resolved Hide resolved
pkg/abstractions/common/instance.go Show resolved Hide resolved
@jsun-m jsun-m changed the title Feat: Add min_containers to QueueDepthAutoscaler Feat: Add min_containers to QueueDepthAutoscaler and instance controller for loading and reloading instances Jan 15, 2025
@jsun-m
Copy link
Contributor Author

jsun-m commented Jan 15, 2025

For the refactored portion of the controllers.

I added a new controller called InstanceController that handles loading and reloading of the AutoscaledInstances. Here's the heirarchy
image

pkg/abstractions/common/instance.go Outdated Show resolved Hide resolved
pkg/abstractions/common/instance.go Outdated Show resolved Hide resolved
}

func (ic *InstanceController) reload(stubId, stubType string) error {
if stubType != types.StubTypeEndpointDeployment && stubType != types.StubTypeASGIDeployment {
Copy link
Contributor

Choose a reason for hiding this comment

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

can you remind me why we have this check? isn't this used for taskqueues as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is wrong. I didnt remove this piece of code when consolidating the logic.

endpointInstances *common.SafeMap[*endpointInstance]
tailscale *network.Tailscale
taskDispatcher *task.Dispatcher
instanceController *abstractions.InstanceController
Copy link
Contributor

Choose a reason for hiding this comment

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

can we just call it controller?

}},
)
go eventBus.ReceiveEvents(ctx)
es.instanceController = abstractions.NewInstanceController(ctx, es.InstanceFactory, []string{types.StubTypeEndpointDeployment, types.StubTypeASGIDeployment}, es.backendRepo, es.rdb)
Copy link
Contributor

Choose a reason for hiding this comment

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

same comment as above

queueClient *taskQueueClient
tailscale *network.Tailscale
eventRepo repository.EventRepository
instanceController *abstractions.InstanceController
Copy link
Contributor

Choose a reason for hiding this comment

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

same comment

stubId := e.Args["stub_id"].(string)
stubType := e.Args["stub_type"].(string)

if stubType != types.StubTypeTaskQueueDeployment {
Copy link
Contributor

Choose a reason for hiding this comment

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

@jsun-m the place where you're doing the correctStub check, you need to return true I think or else it will resend the event

@luke-lombardi luke-lombardi merged commit a573bc9 into main Jan 17, 2025
3 checks passed
@luke-lombardi luke-lombardi deleted the john/be-2200-add-min_containers-to-queuedepthautoscaler branch January 17, 2025 23:12
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.

2 participants