How to make clean API Routes without calling DB connection?

Hi, I have a big project that has been running well for at least 2 years. On my project I have an issue about overload database connection in certain API that i dont use the database to fullfill of API itself,

went I tracing log of laravel queries in the API, there were some of table such as system_plugins_version and offline_sentry making query select, how to handle that query to database is not getting called?

any other reason, I have some API that calling the external API provided by third party, the purpose is to handling the data make adjustment to my app, when it goes so slow to get, my queries have a long open connection for so long also.

When I compare it to Laravel itself, there’s no queries when i returning the static response. Is it able to do that? probably it will work to reduce the active connection of the database.

I’m not make a decision to change other framework for this issue, all the features in octobercms have been used by many things for this project.

first of all, did u use any cache for store requests? how many times u need real life data, how frequently is all changed? - Cache - October CMS - 3.x

when you call an external API endpoints and you are not able to fullfill requests, try to handle this via queue jobs - Setting Up the Scheduler - October CMS - 3.x

Hi @snipi , thank u for make the response.

to be clear, my app is like commerce, integrating with some external e-wallet platform, the functionalities is to get balance of the user and making some transaction order in my app.

I did use the cache, it counts almost a thousand times to get that data every time when open the app, the external API is about to get the user balance from third party e-wallet platform.

I also did use the queue jobs, but its only use for transactional thing for invoking the transaction order.

this is the example of my API and tracing it using telescope :

Route::get('/api/static/data', function(){
    return response()->json(['message' => 'This is API with static data to response, no need database']);

in the back, i found some query database like this :

I just pondering, it is possible OctoberCMS can disable the database connection for my API external that I create for calling external API only?

currently not sure, if this is possieble, but, i thinking about “breaking” a lifecycle of APP and return response before any plugin or app can do anything… maybe in plugin with routes.php file, where you can do anything without any distraction of app.

The first thing to do would be to try to upgrade to the latest version. October CMS is constantly improving, especially in the past two years, it has been worked on more than the first seven years.

I know v3 has better caching to reduce these queries; specifically, the “information schema” query is gone in version 3.

If you are using a Laravel route, then under normal circumstances, it should not result in extra queries. If this is coming from the OFFLINE Sentry plugin, then contacting them about uncached queries on Laravel routes could be useful.

But first, upgrading is the best path to see if this has already been resolved by core improvements.