Comments (8)
The ServerIdleSessionController should detach the session from the connection manager by calling detachThreadLocals: https://github.com/facebook/proxygen/blob/main/proxygen/lib/http/connpool/ServerIdleSessionController.cpp#L38.
Looks like there's a little but of manual work required, some of our non-oss code has this bit:
auto future = serverIdleSessionController_.getIdleSession();
auto func = [=](HTTPSessionBase* session) {
HTTPTransaction* txn = nullptr;
if (session) {
auto evb = session->getEventBase();
if (!evb || !evb->isInEventBaseThread()) {
session->attachThreadLocals(
eventBase, ...);
auto cm = pool_->getTLUpstreamConnManager(eventBase);
if (cm) {
cm->addConnection(session, true);
}
}
}
};
return std::move(future)
.via(eventBase)
.thenValue(func);
from proxygen.
I see! thanks. If i acquire a session via HTTP Connector Callback, and call putSession() to move it into my pool, does the pool override the previously set idleTimeout as soon as the session is put into the pool (Which would come from the wangle::ConnectionManager)
from proxygen.
The ConnectionManager controls the idle timeout (when the session has no open transactions). But if you set a transaction timeout on the session at creation time, that should stick when adding to a different CM.
from proxygen.
Thank you that is very helpful. I am still running into a memory issue in unit testing, but i believe it may be an issue in how we are managing our evb/threads.
On issue 314 you mention that thread transferring can be a huge memory win from server POV, , do you observe the same magnitude of effect on client side?
from proxygen.
For us the memory win on the "client" side (eg: the upstream half of the proxy) is the significant bit. The total memory savings should be roughly the same on both sides, but there are fewer proxies than servers and they tend to be more memory constrained.
from proxygen.
Thanks so much, thats great to hear.
I have one last question before closing: between calling attachThreadLocals() and getIdleSession(), where does the HTTPConnector come into play? Is there a relationship between the session's connection that is being transferred, and its HTTPConnector that is used to establish that connection?
I know in connectionManager I have access to a callback called onConnectionRemoved(const wangle::ManagedConnection* c). Once I have a connection/session established, what role does the HttpConnector play? If i transfer a connection/session I would think I need to either transfer this HttpConnector along with them, or return it to the pool of connectors we use along with our connection manager (since this is how we obtain new sessions/connections).
from proxygen.
So thread A gets session from Thread B. Thread B removes connection from Thread B's connection manager. From thread B perspective, I would need to free up that HTTP connector. But unless I am missing something, onConnectionRemoved() does not give me that access
from proxygen.
Ah I made a mistake. I suppose the connector is irrelevant and it will free itself upon connectSuccess or Error. i will close the issue today.
from proxygen.
Related Issues (20)
- This resolves CVE-2023-44487.
- Building Proxygen in Windows
- HTTP3 Server and Client from samples HOT 11
- Does proxygen support iOS ?
- DetachThreadLocals() fails CHECK HOT 22
- Homebrew build of proxygen failing HOT 7
- ServerIdleSessionConroller:getIdleSession() returns session already in thread HOT 5
- Concurrent performance supported by the HTTP server
- Websocket Key Mismatch HOT 2
- Connection Close Reason SHUTDOWN HOT 3
- `EchoHandler` in `proxygen/httpserver/samples/echo/EchoHandler.h` has unnecessary `body_` member
- Request smuggling vulnerability in Proxygen
- websocket client with SSL problem: Server replied to me "Bad Request" HOT 5
- proxygen fails to build when a newer glog package is installed
- Proxygen for iOS HOT 2
- httpserver/samples/websocket
- Ingress Error and drain() HOT 2
- httpserver/samples/websocket
- Segfault in HQ server
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from proxygen.