Skip to content

Commit

Permalink
Add keepalive
Browse files Browse the repository at this point in the history
  • Loading branch information
ktleunghk01 authored and ktleung2017 committed Mar 18, 2021
1 parent d6c29c8 commit 8797030
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions python/seldon_core/microservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,12 @@ def main():
default=int(os.environ.get("GUNICORN_MAX_REQUESTS_JITTER", "0")),
help="Maximum random jitter to add to max-requests.",
)
parser.add_argument(
"--keepalive",
type=int,
default=int(os.environ.get("GUNICORN_KEEPALIVE", "2")),
help="The number of seconds to wait for requests on a Keep-Alive connection.",
)

parser.add_argument(
"--single-threaded",
Expand Down Expand Up @@ -406,6 +412,7 @@ def rest_prediction_server():
"max_requests_jitter": args.max_requests_jitter,
"post_worker_init": post_worker_init,
"worker_exit": partial(worker_exit, seldon_metrics=seldon_metrics),
"keepalive": args.keepalive,
}
if args.pidfile is not None:
options["pidfile"] = args.pidfile
Expand Down Expand Up @@ -468,6 +475,7 @@ def rest_metrics_server():
"max_requests": args.max_requests,
"max_requests_jitter": args.max_requests_jitter,
"post_worker_init": post_worker_init,
"keepalive": args.keepalive,
}
if args.pidfile is not None:
options["pidfile"] = args.pidfile
Expand Down

0 comments on commit 8797030

Please sign in to comment.