You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/11/06 10:43:00 UTC

[GitHub] [apisix] Miss-you opened a new issue #2643: request help: Use ngx.var.request_id as unique id, not jit-uuid.

Miss-you opened a new issue #2643:
URL: https://github.com/apache/apisix/issues/2643


   ### Issue description
   
   Use `ngx.var.request_id` as unique id, not `jit-uuid`.
   
   The distributed unique id generation algorithm is a classic problem. The current seed of jit-uuid is set by the lua code, while lua always use the same seed by default.
   
   On the other hand, nginx/openresty has a default distributed id -- `ngx.var.request_id`. And after a year of experience, `ngx.var.request_id` itself has a very low collision rate (billions of requests per day) and has never had a request_id/trace_id collision on the same day.
   
   I think it's better to use `ngx.var.request_id` rather than generate uuid by itself.
   
   ref:
   https://github.com/apache/skywalking/issues/5805
   
   ### Environment
   
   * apisix version (cmd: `apisix version`):
   * OS:
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] github-actions[bot] commented on issue #2643: request help: Use ngx.var.request_id as unique id for requests and response tracing, not jit-uuid.

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #2643:
URL: https://github.com/apache/apisix/issues/2643#issuecomment-958808305


   This issue has been marked as stale due to 350 days of inactivity. It will be closed in 2 weeks if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] membphis commented on issue #2643: request help: Use ngx.var.request_id as unique id, not jit-uuid.

Posted by GitBox <gi...@apache.org>.
membphis commented on issue #2643:
URL: https://github.com/apache/apisix/issues/2643#issuecomment-723152572


   we mainly use `jit-uuid` when we need to generate Gateway ID in APISIX, it works in `init_lua` phase. 
   
   I do not think we can use `ngx.var.request_id` in this phase.
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] github-actions[bot] closed issue #2643: request help: Use ngx.var.request_id as unique id for requests and response tracing, not jit-uuid.

Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed issue #2643:
URL: https://github.com/apache/apisix/issues/2643


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] nic-chen commented on issue #2643: request help: Use ngx.var.request_id as unique id, not jit-uuid.

Posted by GitBox <gi...@apache.org>.
nic-chen commented on issue #2643:
URL: https://github.com/apache/apisix/issues/2643#issuecomment-723685913


   > > we mainly use `jit-uuid` when we need to generate Gateway ID in APISIX, it works in `init_lua` phase.
   > 
   > > 
   > 
   > > I do not think we can use `ngx.var.request_id` in this phase.
   > 
   > 
   > 
   > Why Apache APISIX need to generate a uuid in `init` stage? What problem needs to be solved?
   > 
   > 
   > 
   > If it is used for tracing, I think the lifecycle of a request will be in rewrite/access , etc. And `init` or `init_worker` phase don't need uuid.
   
   It's an ID for each APISIX instance, not for each request.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] Miss-you edited a comment on issue #2643: request help: Use ngx.var.request_id as unique id for requests and response tracing, not jit-uuid.

Posted by GitBox <gi...@apache.org>.
Miss-you edited a comment on issue #2643:
URL: https://github.com/apache/apisix/issues/2643#issuecomment-725267485


   we can simply use `api_ctx.var.request_id`
   
   demo code:
   ```
   ngx.log(ngx.ERR, "access request_id:"..tostring(api_ctx.var.request_id))
   ngx.log(ngx.ERR, "access request_id:"..tostring(api_ctx.var.request_id))
   ```
   
   log:
   ``` 
   2020/11/11 15:57:22 [error] 4361#4978301: *1300 [lua] init.lua:339: http_access_phase(): access request_id:da75e5aed5dbd7b6cfe99fd773ea71e9, client: 127.0.0.1, server: , request: "GET / HTTP/1.1", host: "localhost:9080"
   2020/11/11 15:57:22 [error] 4361#4978301: *1300 [lua] init.lua:340: http_access_phase(): access request_id:da75e5aed5dbd7b6cfe99fd773ea71e9, client: 127.0.0.1, server: , request: "GET / HTTP/1.1", host: "localhost:9080"
   ```
   
   ![image](https://user-images.githubusercontent.com/3816205/98784853-adf0b780-2436-11eb-9d6c-29fc318d84d0.png)
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] Miss-you commented on issue #2643: request help: Use ngx.var.request_id as unique id, not jit-uuid.

Posted by GitBox <gi...@apache.org>.
Miss-you commented on issue #2643:
URL: https://github.com/apache/apisix/issues/2643#issuecomment-723724910


   These are two different scenarios.
   I think Apache APISIX itself should use jit-uuid to generate unique ID, but in the case of tracing requests and responses, it should use `ngx.var.request_id`.
   
   > > > we mainly use `jit-uuid` when we need to generate Gateway ID in APISIX, it works in `init_lua` phase.
   > > 
   > > 
   > > > 
   > > 
   > > 
   > > > I do not think we can use `ngx.var.request_id` in this phase.
   > > 
   > > 
   > > Why Apache APISIX need to generate a uuid in `init` stage? What problem needs to be solved?
   > > If it is used for tracing, I think the lifecycle of a request will be in rewrite/access , etc. And `init` or `init_worker` phase don't need uuid.
   > 
   > It's an ID for each APISIX instance, not for each request.
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] github-actions[bot] commented on issue #2643: request help: Use ngx.var.request_id as unique id for requests and response tracing, not jit-uuid.

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #2643:
URL: https://github.com/apache/apisix/issues/2643#issuecomment-958808305


   This issue has been marked as stale due to 350 days of inactivity. It will be closed in 2 weeks if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] Miss-you commented on issue #2643: request help: Use ngx.var.request_id as unique id for requests and response tracing, not jit-uuid.

Posted by GitBox <gi...@apache.org>.
Miss-you commented on issue #2643:
URL: https://github.com/apache/apisix/issues/2643#issuecomment-725267485


   we can simply use `api_ctx.var.request_id`
   
   demo code:
   ```
   ngx.log(ngx.ERR, "access request_id:"..tostring(api_ctx.var.request_id))
   ```
   
   log:
   ``` 
   2020/11/11 15:52:26 [error] 3915#4973481: *12690 [lua] init.lua:339: http_access_phase(): access request_id:191905e1e06f01b9f5c3e6c4f6ed94d2, client: 127.0.0.1, server: , request: "GET / HTTP/1.1", host: "localhost:9080"
   ```
   
   ![image](https://user-images.githubusercontent.com/3816205/98784615-59e5d300-2436-11eb-884e-5279c41b680a.png)
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] github-actions[bot] commented on issue #2643: request help: Use ngx.var.request_id as unique id for requests and response tracing, not jit-uuid.

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #2643:
URL: https://github.com/apache/apisix/issues/2643#issuecomment-958808305


   This issue has been marked as stale due to 350 days of inactivity. It will be closed in 2 weeks if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] membphis commented on issue #2643: request help: Use ngx.var.request_id as unique id for requests and response tracing, not jit-uuid.

Posted by GitBox <gi...@apache.org>.
membphis commented on issue #2643:
URL: https://github.com/apache/apisix/issues/2643#issuecomment-729527688


   Which part of APISIX do you want to update?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] membphis edited a comment on issue #2643: request help: Use ngx.var.request_id as unique id for requests and response tracing, not jit-uuid.

Posted by GitBox <gi...@apache.org>.
membphis edited a comment on issue #2643:
URL: https://github.com/apache/apisix/issues/2643#issuecomment-729527688


   Which part of APISIX do you want to update? @Miss-you 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] github-actions[bot] commented on issue #2643: request help: Use ngx.var.request_id as unique id for requests and response tracing, not jit-uuid.

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #2643:
URL: https://github.com/apache/apisix/issues/2643#issuecomment-958808305


   This issue has been marked as stale due to 350 days of inactivity. It will be closed in 2 weeks if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] github-actions[bot] commented on issue #2643: request help: Use ngx.var.request_id as unique id for requests and response tracing, not jit-uuid.

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #2643:
URL: https://github.com/apache/apisix/issues/2643#issuecomment-971427243


   This issue has been closed due to lack of activity. If you think that is incorrect, or the issue requires additional review, you can revive the issue at any time.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [apisix] Miss-you commented on issue #2643: request help: Use ngx.var.request_id as unique id, not jit-uuid.

Posted by GitBox <gi...@apache.org>.
Miss-you commented on issue #2643:
URL: https://github.com/apache/apisix/issues/2643#issuecomment-723644781


   > we mainly use `jit-uuid` when we need to generate Gateway ID in APISIX, it works in `init_lua` phase.
   > 
   > I do not think we can use `ngx.var.request_id` in this phase.
   
   Why Apache APISIX need to generate a uuid in `init` stage? What problem needs to be solved?
   
   If it is used for tracing, I think the lifecycle of a request will be in rewrite/access , etc. And `init` or `init_worker` phase don't need uuid.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org