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 extra args of feast serve cli in gunicorn #4693

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions sdk/python/feast/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,27 @@ def init_command(project_directory, minimal: bool, template: str):
show_default=True,
help="Number of worker",
)
@click.option(
"--threads",
type=click.INT,
default=1,
show_default=True,
help="Number of thread. When this value increases, concurrency request handling is enabled"
)
@click.option(
"--max-requests",
type=click.INT,
default=0,
show_default=True,
help="The number of requests required to meet the conditions for worker process restart"
)
@click.option(
"--max-requests-jitter",
type=click.INT,
default=0,
show_default=True,
help="A value to update `max-requests` randomly for each process to prevent multiple worker processes from restarting simultaneously",
)
@click.option(
"--keep-alive-timeout",
type=click.INT,
Expand Down Expand Up @@ -942,6 +963,9 @@ def serve_command(
type_: str,
no_access_log: bool,
workers: int,
threads: int,
max_requests: int,
max_requests_jitter: int,
metrics: bool,
keep_alive_timeout: int,
ssl_key_path: str,
Expand All @@ -962,6 +986,9 @@ def serve_command(
type_=type_,
no_access_log=no_access_log,
workers=workers,
threads=threads,
max_requests=max_requests,
max_requests_jitter=max_requests_jitter,
metrics=metrics,
keep_alive_timeout=keep_alive_timeout,
ssl_key_path=ssl_key_path,
Expand Down
6 changes: 6 additions & 0 deletions sdk/python/feast/feature_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,9 @@ def start_server(
port: int,
no_access_log: bool,
workers: int,
threads: int,
max_requests: int,
max_requests_jitter: int,
keep_alive_timeout: int,
registry_ttl_sec: int,
ssl_key_path: str,
Expand Down Expand Up @@ -370,6 +373,9 @@ def start_server(
"bind": f"{host}:{port}",
"accesslog": None if no_access_log else "-",
"workers": workers,
"threads": threads,
"max_requests": max_requests,
"max_requests_jitter": max_requests_jitter,
"keepalive": keep_alive_timeout,
"registry_ttl_sec": registry_ttl_sec,
}
Expand Down
6 changes: 6 additions & 0 deletions sdk/python/feast/feature_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -1894,6 +1894,9 @@ def serve(
type_: str = "http",
no_access_log: bool = True,
workers: int = 1,
threads: int = 1,
max_requests: int = 0,
Copy link
Contributor

Choose a reason for hiding this comment

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

how the server behaves if someone won't set this field and defaults to 0.

Copy link
Author

@young-hun-jo young-hun-jo Oct 25, 2024

Choose a reason for hiding this comment

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

@lokeshrangineni

if threads is set to zero(0), the only one thread is run in server.(In addtion, workers can be set to zero, too. But this is only running a master process not worker process. so can't process client's request. I test it in FastAPI in localhost). I rather worry about this worker argument set to zero.

And if max_requests is set to zero(0), the automatic restart process is disabled(ref: gunicorn docs)

max_requests_jitter: int = 0,
metrics: bool = False,
keep_alive_timeout: int = 30,
ssl_key_path: str = "",
Expand All @@ -1913,6 +1916,9 @@ def serve(
port=port,
no_access_log=no_access_log,
workers=workers,
threads=threads,
max_requests=max_requests,
max_requests_jitter=max_requests_jitter,
metrics=metrics,
keep_alive_timeout=keep_alive_timeout,
ssl_key_path=ssl_key_path,
Expand Down