Problems connecting to an external API
I'm running into an issue connecting with an API I use. How do I know it's not my Linode?
There are a few ways to check if the API is the problem or the Linode. Connecting to an API too often may cause rate-limiting, or the API may block the IP altogether. However, there are few things to check for the Linode.
Networking - Route to API
First, you will want to make sure that the Linode can reach the API using MTR.
While logged into your Linode:
mtr -rwzbc100 <API.DOMAIN>
Typically, you will want to run the MTR commands both ways because the routes could be different, but it's not possible for an API.
If the route doesn't reach the API or there's packet loss throughout, there may be an issue with networking. We recommend opening up a Support Ticket so that Linode Support can take a look and what's happening. If it's outside our data center, we may not be able to intervene and fix it, but we will let you know. If the route reaches the API, you will need to contact the API to see if there are any issues with rate-limiting or blacklisting.
200 and 4xx responses from API
The curl command is also a powerful tool. If you cannot curl the API from your Linode, try to spin up another Linode and run the same curl command.
curl -IL API.DOMAIN
You should receive a 200 OK response if it works. If you receive a 4xx error, check with the API documentation to see what the specific error means.
Host load & CPU Utilization
If you see intermittent issues that are not related to rate limiting, then there could be a problem with the Linode. We recommend checking the Linode to see how it uses the CPU by running the following command:
iostat 1 10
In the output, we want to look at the steal column. It lets us know if your neighbors are using more of their shared resources than what's allotted to them.
In a shared environment, there's always going to be some steal. But as it approaches 15%, you will start to see some latency and could begin to affect reaching the API. If you see steal around or above 15%, copy-paste the output of the
iostat command into a Support Ticket and let us know what's happening. We will see if we can quiet the neighbors. If not, we will try to migrate you to another host.
The Linode Runs Out of Memory (OOM Killer)
One other common issue for problems connecting to an API is when the Linode runs out of memory. You can check the syslog to see if this happens. It looks something like this:
May 16 00:12:33 'hostname' kernel: Out of Memory: Killed process 0000 (mysqld).
May 16 00:12:34 'hostname' kernel: Out of Memory: Killed process 0000 (mysqld).
May 16 00:14:42 'hostname' kernel: Out of Memory: Killed process 0000 (mysqld).
The link below will explain how to troubleshoot OOMing.