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

New host specific TLS contexts system is a memory hog #131

Open
TechnikEmpire opened this issue Oct 3, 2017 · 3 comments
Open

New host specific TLS contexts system is a memory hog #131

TechnikEmpire opened this issue Oct 3, 2017 · 3 comments
Assignees
Labels

Comments

@TechnikEmpire
Copy link
Owner

Didn't realize that TLS contexts were so memory hungry. After extended browsing, this will eat and hold forever a tremendous amount of RAM. This feature needs to be undone.

@TechnikEmpire TechnikEmpire self-assigned this Oct 3, 2017
@TechnikEmpire TechnikEmpire changed the title New host specific TLS contexts is a memory hogging pig New host specific TLS contexts system is a memory hogging pig Oct 3, 2017
@TechnikEmpire
Copy link
Owner Author

We did notice significant performance increases from this system though. There may be a middle ground possible here where we just generate a new context per connection. Some things to consider in whatever solution here include:

  • Session caching
  • TLS session tickets

Disabling both may be necessary, no idea.

@TechnikEmpire
Copy link
Owner Author

Possibly use global yet ref counted host specific contexts. This may be possible by forcing down the ref count on the initial shared_ptr and then we just look for nullptr if we find an existing entry for a host, and re-init the instance when it is nullptr. That may work nicely.

@TechnikEmpire
Copy link
Owner Author

TechnikEmpire commented Oct 3, 2017

should be able to just do something like this:

auto firstSharedPtr = {...};
auto second = firstSharedPtr;
firstSharedPtr.reset();
shared_ptr_container.emplace("hostname", std::move(firstSharedPtr));
return second;

Then just do this when we find an existing elm:

auto res = shared_ptr_container.find("hostname");
if(res != shared_ptr_container.end())
{
    if(res->second.get() == nullptr)
    {
        // Needs to be created again.
    }
}

@TechnikEmpire TechnikEmpire changed the title New host specific TLS contexts system is a memory hogging pig New host specific TLS contexts system is a memory hog Oct 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant