Skip to content
v2.277.0

HttpConnectionPool Struct ​

Connection pool properties for HTTP listeners.

Example ​

ts
// A Virtual Node with a gRPC listener with a connection pool set
declare const mesh: appmesh.Mesh;
const node = new appmesh.VirtualNode(this, 'node', {
  mesh,
  // DNS service discovery can optionally specify the DNS response type as either LOAD_BALANCER or ENDPOINTS.
  // LOAD_BALANCER means that the DNS resolver returns a loadbalanced set of endpoints,
  // whereas ENDPOINTS means that the DNS resolver is returning all the endpoints.
  // By default, the response type is assumed to be LOAD_BALANCER
  serviceDiscovery: appmesh.ServiceDiscovery.dns('node', appmesh.DnsResponseType.ENDPOINTS),
  listeners: [appmesh.VirtualNodeListener.http({
    port: 80,
    connectionPool: {
      maxConnections: 100,
      maxPendingRequests: 10,
    },
  })],
});

// A Virtual Gateway with a gRPC listener with a connection pool set
const gateway = new appmesh.VirtualGateway(this, 'gateway', {
  mesh,
  listeners: [appmesh.VirtualGatewayListener.grpc({
    port: 8080,
    connectionPool: {
      maxRequests: 10,
    },
  })],
  virtualGatewayName: 'gateway',
});
python
# A Virtual Node with a gRPC listener with a connection pool set
# mesh: appmesh.Mesh

node = appmesh.VirtualNode(self, "node",
    mesh=mesh,
    # DNS service discovery can optionally specify the DNS response type as either LOAD_BALANCER or ENDPOINTS.
    # LOAD_BALANCER means that the DNS resolver returns a loadbalanced set of endpoints,
    # whereas ENDPOINTS means that the DNS resolver is returning all the endpoints.
    # By default, the response type is assumed to be LOAD_BALANCER
    service_discovery=appmesh.ServiceDiscovery.dns("node", appmesh.DnsResponseType.ENDPOINTS),
    listeners=[appmesh.VirtualNodeListener.http(
        port=80,
        connection_pool=appmesh.HttpConnectionPool(
            max_connections=100,
            max_pending_requests=10
        )
    )]
)

# A Virtual Gateway with a gRPC listener with a connection pool set
gateway = appmesh.VirtualGateway(self, "gateway",
    mesh=mesh,
    listeners=[appmesh.VirtualGatewayListener.grpc(
        port=8080,
        connection_pool=appmesh.GrpcConnectionPool(
            max_requests=10
        )
    )],
    virtual_gateway_name="gateway"
)
java
// A Virtual Node with a gRPC listener with a connection pool set
Mesh mesh;

VirtualNode node = VirtualNode.Builder.create(this, "node")
        .mesh(mesh)
        // DNS service discovery can optionally specify the DNS response type as either LOAD_BALANCER or ENDPOINTS.
        // LOAD_BALANCER means that the DNS resolver returns a loadbalanced set of endpoints,
        // whereas ENDPOINTS means that the DNS resolver is returning all the endpoints.
        // By default, the response type is assumed to be LOAD_BALANCER
        .serviceDiscovery(ServiceDiscovery.dns("node", DnsResponseType.ENDPOINTS))
        .listeners(List.of(VirtualNodeListener.http(HttpVirtualNodeListenerOptions.builder()
                .port(80)
                .connectionPool(HttpConnectionPool.builder()
                        .maxConnections(100)
                        .maxPendingRequests(10)
                        .build())
                .build())))
        .build();

// A Virtual Gateway with a gRPC listener with a connection pool set
VirtualGateway gateway = VirtualGateway.Builder.create(this, "gateway")
        .mesh(mesh)
        .listeners(List.of(VirtualGatewayListener.grpc(GrpcGatewayListenerOptions.builder()
                .port(8080)
                .connectionPool(GrpcConnectionPool.builder()
                        .maxRequests(10)
                        .build())
                .build())))
        .virtualGatewayName("gateway")
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// A Virtual Node with a gRPC listener with a connection pool set
Mesh mesh;

var node = new VirtualNode(this, "node", new VirtualNodeProps {
    Mesh = mesh,
    // DNS service discovery can optionally specify the DNS response type as either LOAD_BALANCER or ENDPOINTS.
    // LOAD_BALANCER means that the DNS resolver returns a loadbalanced set of endpoints,
    // whereas ENDPOINTS means that the DNS resolver is returning all the endpoints.
    // By default, the response type is assumed to be LOAD_BALANCER
    ServiceDiscovery = ServiceDiscovery.Dns("node", DnsResponseType.ENDPOINTS),
    Listeners = new [] { VirtualNodeListener.Http(new HttpVirtualNodeListenerOptions {
        Port = 80,
        ConnectionPool = new HttpConnectionPool {
            MaxConnections = 100,
            MaxPendingRequests = 10
        }
    }) }
});

// A Virtual Gateway with a gRPC listener with a connection pool set
var gateway = new VirtualGateway(this, "gateway", new VirtualGatewayProps {
    Mesh = mesh,
    Listeners = new [] { VirtualGatewayListener.Grpc(new GrpcGatewayListenerOptions {
        Port = 8080,
        ConnectionPool = new GrpcConnectionPool {
            MaxRequests = 10
        }
    }) },
    VirtualGatewayName = "gateway"
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// A Virtual Node with a gRPC listener with a connection pool set
var mesh Mesh

node := appmesh.NewVirtualNode(this, jsii.String("node"), &VirtualNodeProps{
	Mesh: Mesh,
	// DNS service discovery can optionally specify the DNS response type as either LOAD_BALANCER or ENDPOINTS.
	// LOAD_BALANCER means that the DNS resolver returns a loadbalanced set of endpoints,
	// whereas ENDPOINTS means that the DNS resolver is returning all the endpoints.
	// By default, the response type is assumed to be LOAD_BALANCER
	ServiceDiscovery: appmesh.ServiceDiscovery_Dns(jsii.String("node"), appmesh.DnsResponseType_ENDPOINTS),
	Listeners: []VirtualNodeListener{
		appmesh.VirtualNodeListener_Http(&HttpVirtualNodeListenerOptions{
			Port: jsii.Number(80),
			ConnectionPool: &HttpConnectionPool{
				MaxConnections: jsii.Number(100),
				MaxPendingRequests: jsii.Number(10),
			},
		}),
	},
})

// A Virtual Gateway with a gRPC listener with a connection pool set
gateway := appmesh.NewVirtualGateway(this, jsii.String("gateway"), &VirtualGatewayProps{
	Mesh: Mesh,
	Listeners: []VirtualGatewayListener{
		appmesh.VirtualGatewayListener_Grpc(&GrpcGatewayListenerOptions{
			Port: jsii.Number(8080),
			ConnectionPool: &GrpcConnectionPool{
				MaxRequests: jsii.Number(10),
			},
		}),
	},
	VirtualGatewayName: jsii.String("gateway"),
})

Properties ​

maxConnectionsnumbermax_connectionsint | floatmaxConnectionsNumberMaxConnectionsdoubleMaxConnections*float64= nonerequired#
The maximum connections in the pool.
maxPendingRequestsnumbermax_pending_requestsint | floatmaxPendingRequestsNumberMaxPendingRequestsdoubleMaxPendingRequests*float64= nonerequired#
The maximum pending requests in the pool.