I. Overview
The router component routes all incoming requests in cloud foundry.
There are two main types of requests for accessing the router: management commands from vmcclient or STS. These requests are routed to the applife management component, also known as the cloudcontroller component; the second type is the external request to access your deployed apps. This part of requests will be routed to appexecution or DEAS components.
The system can deploy multiple routers to process the requests, but the loadbalance at the upper layer of the router is not in the Implementation scope of cloudfoundry. cloudfoundry only ensures that all requests are stateless, in this way, the upper-layer Server Load balancer has a very large selection area. It is feasible to use DNS, deploy the hardware loadbalancer, or simply set up an ngnix Server Load balancer.
Ii. Composition Architecture
The current version of the router component is a simple encapsulation of nginx. It consists of ngnix and router. RB. nginx uses the socket file (. Sock file) for input, and router. RB implements the logical encapsulation of nginx. The structure of the router component is as follows:
When the external httprequest enters the cloud foundry server, nginx receives the request first. nginx interacts with router. RB through sock (so the router component is used to process the request ). The router. RB performs logical judgment based on the input URL, user name, password, etc. Data is obtained from the cloudcontroller component or the DEA component and returned through the. Sock file connected to the network controller. Router. Rb is a logical encapsulation of nginx. Those familiar with cloudfoundry must know that cloudfoundry assigns a URL access to each app. If you directly use the cloudfoundry.com hosted by Vmware, your app URL may be xxx.cloudfoundry.com, no matter how many instances are extended to your app by using commands, they are all accessed from this URL. Here, the URL conversion route is forwarded by the router. RB implementation.
Note:: In the second version, because Ruby cannot directly process the request performance, the Lua script is used to receive the request, and then the ruby program returns the result.
Cocould Foundry (3) -- Router