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

introduce content phase #535

Merged
merged 3 commits into from
Jan 18, 2018
Merged

introduce content phase #535

merged 3 commits into from
Jan 18, 2018

Conversation

mikz
Copy link
Contributor

@mikz mikz commented Dec 22, 2017

Content phase is for generating actual content. APIcast policy is going to use ngx.exec to do internal redirect to the @upstream location which handles fetching the upstream response by post_action.

Policies can hook into this process by implementing own content handler that will respond with headers and body. For example some policy could fetch the upstream response by cosocket API instead of using nginx proxy_pass.

Performance

Before

wrk --connections 10 --threads 10 --duration 60 'http://localhost:8080/?user_key=foo'
Running 1m test @ http://localhost:8080/?user_key=foo
  10 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     3.46ms    1.02ms  15.42ms   82.60%
    Req/Sec   291.47     31.81   626.00     79.82%
  174339 requests in 1.00m, 63.34MB read
Requests/sec:   2901.39
Transfer/sec:      1.05MB

After

wrk --connections 10 --threads 10 --duration 60 'http://localhost:8080/?user_key=foo'
Running 1m test @ http://localhost:8080/?user_key=foo
  10 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     3.59ms    1.01ms  16.29ms   82.44%
    Req/Sec   280.77     30.10   404.00     78.13%
  167966 requests in 1.00m, 61.02MB read
Requests/sec:   2795.01
Transfer/sec:      1.02MB

@mikz mikz force-pushed the content-phase branch 2 times, most recently from 4346bf1 to 2468c6c Compare December 22, 2017 15:23
@mikz mikz force-pushed the content-phase branch 2 times, most recently from b6a57a9 to 6f8f137 Compare January 12, 2018 12:19
@mikz mikz changed the title [wip] introduce content phase introduce content phase Jan 12, 2018
@mikz mikz requested a review from davidor January 12, 2018 16:52
post_action defined and log only runs when post_action runs.
init and init_worker are not run either. They are not executed in policies
defined at the service level.
normal apicast policy, so we can check that the authorize flow continues working.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The part about init and init_worker still applies, but has been deleted.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right!

@mikz mikz merged commit bc1305b into master Jan 18, 2018
@mikz mikz deleted the content-phase branch January 18, 2018 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants