I'm new to REST developing and i'm creating a simple rest API to request database values from clients. I have used the "Delphi Web Server Application" project assistant (the one that uses TIdHTTPWebBrokerBridge and the WebModule where you create the different 'Actions'). It works fine and I can make requests from client(s).
The server WebModule contains a FDConnection and some FDQuery components to make the database (MySQL) queries, and each Action executes a specific query with specific params obtained throug request params.
The client app uses TRESTResponse, TRESTRequest, TRESRResponse components to send/receive the data.
For example:
- client request to server some values for a specific user, sending "user = user1" and "passwd = ***" as request params.
- server executes the query "select * from xxx where user = user1 and passwd = ...…..." and sends the response to the client.
Every query is "user-specific".
Ok, it works, but now I have some misgivings due to my rest/webbroker functioning ignorance.
What if thousands of requests are made at a time? Could the server respond incorrect data because the FDQuery cursor is in another record? Or does the webbroker create the query for each request with no problem?
Is it better to create the FDQuery at runtime for each request and destroy it after request completion?
I made a simple test yesterday, running three instances of the Client application and sending 300 requests to the server (100 from each client) simultaneously and it worked, receiving correct data, but I don't know if this is enough guarantee.
Is this (Delphi Web Server Application) the correct method to créate the server? What are the differences with DataSnap?
Any advice?