You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "kingluo (via GitHub)" <gi...@apache.org> on 2023/04/07 07:38:59 UTC

[GitHub] [apisix] kingluo commented on pull request #9259: avoid creating the whole radixtree while changing one route

kingluo commented on PR #9259:
URL: https://github.com/apache/apisix/pull/9259#issuecomment-1500029858

   In fact, we should do below steps to implement incremental route synchronization:
   
   * export `raxRemove` as lua API
   
   https://github.com/api7/lua-resty-radixtree/blob/5364cbfe742a5a11f45c16d66b38d7e7b8bd969c/src/rax.c#L1020
   
   ```c
   /* Remove the specified item. Returns 1 if the item was found and
    * deleted, 0 otherwise. */
   int raxRemove(rax *rax, unsigned char *s, size_t len, void **old)
   ```
   
   Then:
   
   Delete a route in etcd equals removing the old route item from the radix tree.
   Update a route in etcd equals removing the old route item and inserting a new one into the radix tree.
   
   * update the route in filter, not in config_etcd, because that handles watching for all resources, not only routes
   
   https://github.com/apache/apisix/blob/8805fc543f03bf04eec656d69eb46ed2377db1ce/apisix/router.lua#L30-L45
   
   * disable full update of radix tree
   
   https://github.com/apache/apisix/blob/8805fc543f03bf04eec656d69eb46ed2377db1ce/apisix/http/router/radixtree_uri.lua#L31-L41
   


-- 
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