Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Commit

Permalink
First pass for router v2 implementation. The init version of router v…
Browse files Browse the repository at this point in the history
…2 is done by

Jun Xiao, polished by Anfernee with a couple of bug fixes and enhancement.

router v2 decouples control and data path to some extent, it's a logic router
including both nginx and uls (upstream location server) parts.

uls (aka control plane) is based on legacy router:
- all communications with nats are kept the same as before
- client facing interface (actually connected to nginx) is simplified to
  handle the location query/stats update from nginx only.
- the original app facing interface is totally removed.

nginx (aka data plane)
- package lua in nginx so most functionalities can be implemented with it.
- for each request, nginx will generate a subrequest (to fit in nginx
  single thread event model) which carries location query/stats info to uls,
  the response of the subrequest will return backend addr and also an
  opaque tags (only known by uls), and the corresponding main request will
  also be awaked and routed to the backend server, when a response from backend
  is returned back, the counter associated with the particular opaque tags
  will be incremented accoring to the response code. The next incoming
  request will always help to carry not-synced stats to uls along with
  its location query.
- sticky session and trace header are also implemented here,
  also their key related config are moved to nginx part.

testing
- "rake spec" will only test uls, while "rake test" will run both unit test and
  integration test with nginx
- integration test requires nginx with lua module installed running

Change-Id: I9b25b24c449b0421754e541ab5ba60a00c551da9
  • Loading branch information
anferneeg committed Dec 16, 2011
1 parent 9fde59f commit 3fec163
Show file tree
Hide file tree
Showing 15 changed files with 908 additions and 708 deletions.
6 changes: 5 additions & 1 deletion Rakefile
Expand Up @@ -49,7 +49,11 @@ namespace "test" do
sh("cd spec && rake spec")
end

task "spec:rcov" do |t|
task "test" do |t|
sh("cd spec && rake test")
end

task "spec:rcov" do |t|
sh("cd spec && rake spec:rcov")
end
end
2 changes: 0 additions & 2 deletions lib/router.rb
Expand Up @@ -21,7 +21,6 @@

require 'router/const'
require 'router/router'
require 'router/app_connection'
require 'router/client_connection'
require 'router/utils'

Expand Down Expand Up @@ -183,4 +182,3 @@
end

end

200 changes: 0 additions & 200 deletions lib/router/app_connection.rb

This file was deleted.

0 comments on commit 3fec163

Please sign in to comment.