Mysql Async vs PerformHttpRequest

So i was thinking.

Would there be any benefit in making a backend api to call through PerformHttpRequest instead of using mysql-async plugin as a resource?

What are your thoughts?


Depends on what’s you want, if all query will come directly from the server, it isn’t really useful. If requests are from client, same amount of request, but from server there will be one more.

But, if you want to use your api from an extern web app, it can be useful .

I was quite thinking doing all requests towards the api.

I may wanna do a test to see if it does any difference.

I would guess it would performe worse, personally. There would likely be higher latancy via HTTP/S versus straight MySQL queries. This also opens you up to potential API abuse.

There is lots of discussion on StackOverflow, etc. about direct database access versus API access. I think both do have pros and cons, but if performance is what you’re after, I believe direct will perform better. I have no proof to back this up, but would love to be proven wrong. You’re talking essentially calling a webpage, having the webpage query a database (presumably?), have the webpage render those results, fetch the webpage, parse the webpage, return values. That’s a lot more hops than just fetching direct information.

Almost. I want to send post and get requests to an api i will be making along side. The api will do the querys correct, but all returned data will be returned with a status code and json.

I’m thinking i would relieve some stress on the resources doing this. However i will do a test maybe later today.

I’m curious the results of the test. Please do share.

I will, are there any kind of specific test you want to see. I was planning on multiple tests:

1: Api on the same server
2: Api on external server.

That makes sense. I’d try to come up with an easy way to track milliseconds for total response time.