HttpFilteringEngine
HttpFilteringEngine copied to clipboard
New host specific TLS contexts system is a memory hog
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.
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.
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.
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.
}
}