Skip to content

How to determine/debug if connections are being reused? #95

Open
@Ghazgkull

Description

@Ghazgkull

I'm attempting to enable connection reuse for a simple application using this module, but I'm not sure how to verify whether connections are being reused.

I tried adding some simple logging after each request to look at the agent status. Is that the right way to determine if it's working?

Using the default options, I tried making three requests using an HTTPS agent, and I see the following statuses printed using JSON.stringify(agent.getCurrentStatus()). Am I right to think that connections aren't being reused here? Is there any way to debug connection reuse?

Agent status: {"createSocketCount":1,"createSocketErrorCount":0,"closeSocketCount":0,"errorSocketCount":0,"timeoutSocketCount":0,"requestCount":1,"freeSockets":{"redacted.com:443::::::::::::::::::":1},"sockets":{},"requests":{}}
Agent status: {"createSocketCount":1,"createSocketErrorCount":0,"closeSocketCount":0,"errorSocketCount":0,"timeoutSocketCount":0,"requestCount":1,"freeSockets":{"redacted.com:443::::::::::::::::::":1},"sockets":{},"requests":{}}
Agent status: {"createSocketCount":1,"createSocketErrorCount":0,"closeSocketCount":0,"errorSocketCount":0,"timeoutSocketCount":0,"requestCount":1,"freeSockets":{"redacted.com:443::::::::::::::::::":1},"sockets":{},"requests":{}}```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions