Thank you. No more question from me for this topic. :)
I think next step is really for me to confirm everything with support team.
Original Message:
Sent: Wed April 10, 2024 08:40 AM
From: Chris Dudley
Subject: Rate limit reset at start of every month automatically
No I meant if what the support team said about when the count is reset, if that's correct then editing the rate limits and republishing should do what you want.
I thought the count started from when the subscription was created but it might be from first api call. You might need to experiment to find out which but I'm not sure it really matters in this scenario.
------------------------------
Chris Dudley
Original Message:
Sent: Wed April 10, 2024 08:31 AM
From: Guo Jun Qiao
Subject: Rate limit reset at start of every month automatically
Fully understand. Thanks a lot and really appreciate the help you provided.
By the way, above you mentioned: if what the support team said is correct then your proposal should work. You mean you checked and support team said my proposal should work?
Also would like to seek your advice on below question.
When APIC gateway starts to count rate limit, it starting when consumer organization subscribe to one plan?
------------------------------
Guo Jun Qiao
Original Message:
Sent: Wed April 10, 2024 08:12 AM
From: Chris Dudley
Subject: Rate limit reset at start of every month automatically
I'm afraid I can't conclusively confirm anything having not tried it.
If what the support team said is correct then your proposal should work but I can't say any more than that and I've already said my opinion of artificially enforcing custom rate limits like this. It's confusing to the consumer.
Try it and see but I would also recommend chasing formal support in the product via an RFE for the future to mean such external scripting isn't necessary.
------------------------------
Chris Dudley
Original Message:
Sent: Wed April 10, 2024 07:48 AM
From: Guo Jun Qiao
Subject: Rate limit reset at start of every month automatically
This is core requirement and our project team have to deliver it in July.
We really appreciate if APIC product team can advise on whether it can be done through customisation? If can, kindly advise what is the way to do the customisation?
------------------------------
Guo Jun Qiao
Original Message:
Sent: Wed April 10, 2024 06:22 AM
From: Guo Jun Qiao
Subject: Rate limit reset at start of every month automatically
Yeah, sometimes just use it to give me a first idea same as we using Google to search something. Every point we always confirm with IBM.
Just feel cannot find too much information about APIC from IBM documentation and online.
based on what we discussed above, do you think it can work?
I think at least for using API to change rate limit policy and then publish the change to Gateway, this is feasible right? I read APIC doc and understand most of APIC tasks can be performed via API or CLI command.
------------------------------
Guo Jun Qiao
Original Message:
Sent: Wed April 10, 2024 06:09 AM
From: Chris Dudley
Subject: Rate limit reset at start of every month automatically
Please do not use information from ChatGPT as evidence of anything. It could be hallucinating like mad and our support team will just laugh at you if you try to suggest output like that has any bearing. :-)
Find the info in our docs or ask support.
------------------------------
Chris Dudley
Original Message:
Sent: Wed April 10, 2024 06:02 AM
From: Guo Jun Qiao
Subject: Rate limit reset at start of every month automatically
Based on my current understanding (we have raised PMR for IBM to confirm in what situations the rate limit counter will reset) the rate limit counter will restart when
- Rolling period exceeded
- Gateway reboot ( rate limit stored in memory not in local disk)
- any changes made to rate limit and republished to gateway.
I asked ChatGPT this question :
IBM API Connect, when I change rate limit and publishing the change to gateway, will rate limit counter restart in gateway
the reply is
When you change the rate limit in IBM API Connect and publish the change to the gateway, the rate limit counter does not automatically restart. The rate limit counter continues to operate based on the existing configuration until the rate limit window expires. Once the rate limit window resets according to its defined duration, the new rate limit configuration will take effect, and the counter will start afresh based on the updated settings.
I think this can meet my requirements. Instead of first day of every month I modify rate limit plan and republishing, I do it at last day of every month so that next day the new change will take effect. Also rate limit counter restarted.
------------------------------
Guo Jun Qiao
Original Message:
Sent: Wed April 10, 2024 05:47 AM
From: Chris Dudley
Subject: Rate limit reset at start of every month automatically
But there isn't an API to call to reset the counter - thats what I am not following.
You can update the plan rate limits but I don't think that is going to reset the counters for existing consumers.
------------------------------
Chris Dudley
Original Message:
Sent: Wed April 10, 2024 05:42 AM
From: Guo Jun Qiao
Subject: Rate limit reset at start of every month automatically
I'm not sure I am following.
APIC lets you set a rate limit per day/week etc but not month.
Perdonally I don't think using external crons to modify plans consumers have already signed up to is a very good idea. From the consumer's point of view it's not what they signed up for.
[Guo Jun]
This is an important requirement which we have to deliver by using APIC. Currently we have existing API Gateway which resetting rate limit at first day of every month. Now we are migrating APIs from this existing API Gayeway to APIC. The same behaviour is expected from APIC. This is something agreed between Provider organisation and consumer organisations.
Just would like to explain a bit about resetting rate limit. Actually we do not change rate limit threshold. Just want to restart rate limit counter at first day of every month. For example, consumer organisation A subscribed a plan with 300K call per month. Assume this consumer organisation used 200K call and left 100K call from 1sr Apr 2024 to 30 Apr 2024. When May 2024 started, Provider Organization wants to reset rate limit counter so that consumer Organization A will have 300 K call again from 1st May 2024 to 31 May 2024.
It's definitely not tested by us so there could well be performance implications.
But even ignoring the general practice being a bad idea I don't see how it achieves what you want. What rate limit are you putting in the plan and then what are you changing it to when you exit the plan in your cron?
[Guo Jun] take above example,
in 1 April 2024, the script will set Day=30, rate limit =300K
in 1 May 2024, the script will set Day=31, rate limit= 300K
The rolling time interval runs, I think, from when they subscribe. So if they subscribe on Wednesday then a weekly rate limit will run until next Wednesday. They are relative rolling intervals not fixed arbitrary ones based on the calendar.
[Guo Jun] Fully understand the rationale behind the design. Actually this is also another question I asked. When APIC gateway starts to count rate limit? It starts when consumer organisation subscribe the plan or it starts when first API call reaching gateway?
Actually regardless when it starts to count, it cannot meet our requirements. What we want is to let all consumer organisations (more than 25) to follow calendar month. Rate limit will starts from first day of month and end at last day of month for all consumer organisations.
You may think that we want to monetise from consumer organisations consuming our APIs. Same as our mobile phone data plan or bank credit card billing period. It will be very difficult for telecom or bank companies to mange if each of customer starting billing period at any day of month and end at any day of month.
You can look through the public RFEs and see if there is one already, I'm not aware of one but that doesn't mean it doesn't exist.
[Guo Jun] Ok
------------------------------
Guo Jun Qiao
Original Message:
Sent: Wed April 10, 2024 05:02 AM
From: Chris Dudley
Subject: Rate limit reset at start of every month automatically
I'm not sure I am following.
APIC lets you set a rate limit per day/week etc but not month.
Perdonally I don't think using external crons to modify plans consumers have already signed up to is a very good idea. From the consumer's point of view it's not what they signed up for. It's definitely not tested by us so there could well be performance implications.
But even ignoring the general practice being a bad idea I don't see how it achieves what you want. What rate limit are you putting in the plan and then what are you changing it to when you exit the plan in your cron?
The rolling time interval runs, I think, from when they subscribe. So if they subscribe on Wednesday then a weekly rate limit will run until next Wednesday. They are relative rolling intervals not fixed arbitrary ones based on the calendar.
You can look through the public RFEs and see if there is one already, I'm not aware of one but that doesn't mean it doesn't exist.
------------------------------
Chris Dudley
Original Message:
Sent: Wed April 10, 2024 04:50 AM
From: Guo Jun Qiao
Subject: Rate limit reset at start of every month automatically
Hi Chris,
if the reply is not wrong, then I think I can achieve what I asked. Basically I will create a script outside of APIC. This script will call API from APIC to modify rate limit policy within a plan, and then publishing the change to gateway. I will use Linux Cron to trigger this script at first day of every month.
Need your advise if there is any implications?
Do you know anyone raised RFE before for such feature?
------------------------------
Guo Jun Qiao
Original Message:
Sent: Wed April 10, 2024 04:23 AM
From: Chris Dudley
Subject: Rate limit reset at start of every month automatically
Hiya
Like a lot of responses from AI you need to take it with a pinch of salt. What it replied is not wrong, but it also doesn't achieve what you asked!
I am not aware of a means to force reset the rate limits per month. We intentionally do rolling intervals for seconds, minutes, hours, days, weeks because it avoids any issues with months not being the same size.
I think you are in RFE territory here.
------------------------------
Chris Dudley
Original Message:
Sent: Sun April 07, 2024 09:10 PM
From: Guo Jun Qiao
Subject: Rate limit reset at start of every month automatically
Hi Chris,
I tried to ask ChatGPT the question: "Can call API to set rate limit?"
The response from ChatGPT is as below (green color text).
This is exact my thought to fulfill the requirement: "reset rate limit at 1st day of every month."
Just need your advise if below response is correct. Are there any implications or things to consider if I using this way to reset rate limit at 1st day of every month?
In IBM API Connect, you can automate the process of setting rate limits for your APIs using the API Connect Management REST API or CLI. This allows you to programmatically interact with API Connect to configure rate limiting policies, among other settings.
Using the API Connect Management REST API, you can perform actions such as creating or updating API definitions, adding rate limiting policies, and deploying APIs to specific environments. Similarly, the CLI provides commands to perform these tasks from the command line interface.
Here's a general overview of the steps to set rate limits using the API:
1. Authenticate: Obtain authentication credentials (such as an API key or OAuth token) to access the API Connect Management API.
2. Retrieve API Definition: Retrieve the definition of the API you want to configure rate limiting for using the API Connect Management API.
3. Add Rate Limiting Policy: Modify the API definition to include a rate limiting policy with your desired configuration, such as the maximum number of requests allowed per unit of time.
4. Update API Definition: Update the API definition with the modified configuration using the API Connect Management API.
5. Deploy API: Deploy the updated API to the desired environment using the API Connect Management API.
By automating these steps using scripting or integration with your CI/CD pipeline, you can efficiently configure rate limits for your APIs in IBM API Connect. This allows for consistent and scalable management of API traffic and resource usage.
------------------------------
Guo Jun Qiao
Original Message:
Sent: Fri April 05, 2024 03:52 AM
From: Guo Jun Qiao
Subject: Rate limit reset at start of every month automatically
Hi Chris,
This post is about rate limit. This is a key requirement and without this requirement fulfilled we are not able to rollout this APIC to production.
Just a check if possible for us to have call with you to clarify all these things? :)
Requirement:
We have requirement to reset rate limit at first day of every month.
Rational behind the requirement:
Same as our mobile phone data plan, every month we have for example 100GB data. This month we used 80GB data. When coming to next month, the data limit will be reset at 100GB. It will be difficult for Telecom company to manage if different users can start at any day of this month and end at and of next month.
Same for us, we want to set rate limit at the 1st day of every month for all our client organizations. So every of our client organizations will have same start (which is 1st day of month) and end data (which is last day of month).
The Workaround solution I am thinking
We checked with IBM support, the response was there is no out-of-box feature, also do not have customization solution to reset rate limit at 1st day of month.
However my thinking is, I as user login to API Manager and change the rate limit at 1st day of every month, and then publish the API to API gateway. If this manual process is feasible, then automating this process should also feasible. I have checked and there are APIs or Command line can do almost all of actions against the functions in APIC.
So would like to seek your advise if my thinking is feasible?
Apart from above point, also would like check how current APIC out of box rate limit feature works.
Question 1: Rate Limit
Scenario 1: Based on the update we have from IBM, there is no OOTB solution in apic v10.0.5 to reset the rate limit on the first day of each month. The available workaround is to reset the rate limit to 30 or 31 days.
In this case, for example, client organization 1 was onboarded to APIC on the first day of the month. The plan is 300k, and the rate limit reset is set to 30 days.
Client organization 2 was onboarded on the 10th day of the month. The plan is 400k, and the rate limit reset is set to 30 days.
1) When the rate limit start to count for client organization 1 and 2? Is it starting to count after client organization subscribed to product plan, or it will start to count after first request from client organization reaching to rate limit policy?
2) On which day rate limit will be reset for client organization 1 and 2?
3) Is it feasible to reset or change the duration to the 15th day when the current reset is set for the 30th day?
4) In what scenario will the rate limit get reset (other than duration reached)? For example, does the below scenario trigger reset?
- When DC failover occurs
- When there is a config change on the rate limit
- When API Gateway servers reboot
-Others
5) We understand that Gateway manages that rate-limit counter. What happens if we reboot all the 3x gateways in the cluster? Does the rate-limit count get reset, or does it persist the rate-limit to continue the count from before the reboot of the Gateway?
Question 2: Notification for rate limit threshold reaching
We require fetching the users' current rate limit utilization and sending an email when rate limit reaching. However, we know that APIC doesn't have an email notification feature to send. We are looking for a solution where we place a script on an external server and trigger an API that can connect to the Analytics subsystem to get the current utilization of the limit and then send an email. Could you share us the API that can get the details.
Also would like to check is it possible to use API connecting to API gateway directly and get rate limit? If possible, could you share the API? Why we are considering to get rate limit utilization data from API gateway directly is because we concerned that if Analytics subsystem down, then we are not able to get correct rate limit utilization data to send notification.
Question 3: Rate limit replication between data center A and data center B.
The customer environment has 2 DCs for the Production environment: Prod1 and Prod2. The APIC setup is active in Prod1 and warm in Prod2. As per the customer BCP requirement, the customer runs the APIC for a few months and fails over the traffic from Prod1 to Prod2 during the middle of the month. We understand there is no replication for the gateway to transfer the rate limit from the PROD1 to the PROD2 apic environment. However, the customer would like to transfer and set the utilized rate limit from PROD1 when the traffic is switched to the PROD2 site.
------------------------------
Guo Jun Qiao
Original Message:
Sent: Wed April 03, 2024 08:50 PM
From: Guo Jun Qiao
Subject: Rate limit reset at start of every month automatically
Hi Chris,
In current APIC 10.0.5, we can set rate limit at number of calls per numbers of second, minute, hour, day, and week. However we have requirement to set rate limit as per month. Because of APIC does not have it, so we are exploring if can use DAY to do it. What we want to achieve is as below.
Would like to check with you if there is any way we can achieve it? Previously I thought to build a script to call API call to change it at first day of every month. However when we checked with IBM how do it and response from IBM was no way can do it.
Jan: 31 days: 300K call
Feb: 28 days: 300K call
Mar: 31 days: 300K call
Apr: 30 days: 300K call
May: 31 days: 300K call
Jun: 30 days: 300K call
July: 31 days: 300K call
Aug: 31 days: 300K call
Sep: 30 days: 300K call
Oct: 31 days: 300K call
Nov: 30 days: 300K call
Dec: 31 days: 300K call
------------------------------
Guo Jun Qiao
------------------------------