[EventEngine] Add advice against blocking work in callbacks (#32397)

<!--

If you know who should review your pull request, please assign it to
that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the
appropriate
lang label.

-->
pull/32411/head
AJ Heller 2 years ago committed by GitHub
parent 77d2475074
commit ffe3968d0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 21
      include/grpc/event_engine/event_engine.h

@ -33,6 +33,11 @@ namespace grpc_event_engine {
namespace experimental {
////////////////////////////////////////////////////////////////////////////////
/// The EventEngine Interface
///
/// Overview
/// --------
///
/// The EventEngine encapsulates all platform-specific behaviors related to low
/// level network I/O, timers, asynchronous execution, and DNS resolution.
///
@ -44,7 +49,8 @@ namespace experimental {
///
/// A default cross-platform EventEngine instance is provided by gRPC.
///
/// LIFESPAN AND OWNERSHIP
/// Lifespan and Ownership
/// ----------------------
///
/// gRPC takes shared ownership of EventEngines via std::shared_ptrs to ensure
/// that the engines remain available until they are no longer needed. Depending
@ -71,6 +77,19 @@ namespace experimental {
/// std::unique_ptr<Server> server(builder.BuildAndStart());
/// server->Wait();
///
///
/// Blocking EventEngine Callbacks
/// -----------------------------
///
/// Doing blocking work in EventEngine callbacks is generally not advisable.
/// While gRPC's default EventEngine implementations have some capacity to scale
/// their thread pools to avoid starvation, this is not an instantaneous
/// process. Further, user-provided EventEngines may not be optimized to handle
/// excessive blocking work at all.
///
/// *Best Practice* : Occasional blocking work may be fine, but we do not
/// recommend running a mostly blocking workload in EventEngine threads.
///
////////////////////////////////////////////////////////////////////////////////
class EventEngine : public std::enable_shared_from_this<EventEngine> {
public:

Loading…
Cancel
Save