Cost of plugins pipelines - Serverless plugin in production ? #11323
-
Hi,
It works fine, but I wonder about the cost of such pipelines and especially the serverless one (regardless of the function itself). Thanks in advance ! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
I'd personally avoid However, are you aware that you can define multiple routes, define an additional check in addition to the usual domain/URI/method, and APISIX will try them them in order and forward to the first match found. Here's an example using an HTTP header: routes:
- uri: /thingies*
name: Europe
upstream_id: 1
vars: [["http_x-country", "==", "fr"]]
priority: 3
- uri: /thingies*
name: USA
upstream_id: 2
vars: [["http_x-country", "==", "us"]]
priority: 2
- uri: /thingies*
name: default
upstream_id: 1
priority: 1 APISIX will try to match the route You can use any NGINX variable, not only HTTP headers (cookies, etc.). |
Beta Was this translation helpful? Give feedback.
-
Thanks very much for your answer, Could you explain why the traffic split plugin is not adapted here ? In its description, it is said that "it can be used to dynamically direct portions of traffic to various Upstream services". |
Beta Was this translation helpful? Give feedback.
-
IMHO, the
Do I understand correctly that the forwarding logic is outside of APISIX, i.e., in the catalog service? In this case, indeed, you'll incur additional performance hits, not because of the pipeline in itself but because of the extra query. It would be much better to let APISIX manage the forwarding data. If you can't, I suggest that you manage a local cache, so you query the catalog only on the first request. Even better, you could pre-warm the cache. Unfortunately, at this point, it goes well beyond APISIX and is about system architecture: options are infinite, it all depends on your requirements and your budget. |
Beta Was this translation helpful? Give feedback.
IMHO, the
traffic-split
plugin is for random forwarding. If you already know the population, it's much better to use my way.Do I understand correctly that the forwarding logic is outside of APISIX, i.e., in the catalog service?
In this case, indeed, you'll incur additional performance hits, not because of the pipeline in itself but because …