I am developing a server that answers requests from a running application on my smartphone or browser.
Each request is in json and then there is a function that runs a query against the SQL server. The answer I translate to json and return to her.
There are situations where there are more than 150 queries, each query can even take a few seconds.
Do your components support such a solution?
Do you have an example?
queries & thread
Re: queries & thread
There is no separate component with the implemented functionality of a server application. As one of the solutions you can use UniDAC + DataSnap technology. You can see the sample in our blog:
http://blog.devart.com/using-dac-produc ... pment.html .
To solve the described issue, you can use the above solution or any other one.
P.S. UniDAC allows developing custom apps that can connect to remote ASE directly without using a three-tier application for the following platforms:
-Windows, 32-bit and 64-bit
-MacOS
-Linux, 32-bit (only in Lazarus and Free Pascal) and 64-bit
-iOS, 32-bit and 64-bit
-Android
-FreeBSD (only in Lazarus and Free Pascal) 32-bit and 64-bit
http://blog.devart.com/using-dac-produc ... pment.html .
To solve the described issue, you can use the above solution or any other one.
P.S. UniDAC allows developing custom apps that can connect to remote ASE directly without using a three-tier application for the following platforms:
-Windows, 32-bit and 64-bit
-MacOS
-Linux, 32-bit (only in Lazarus and Free Pascal) and 64-bit
-iOS, 32-bit and 64-bit
-Android
-FreeBSD (only in Lazarus and Free Pascal) 32-bit and 64-bit
Re: queries & thread
I'm not using DataSnap. I use another component of ipworks that manages the server references.
I saw the example you sent me but when I run TUniQuery I can not run another TUniQuery until the first one does not give an answer.
In fact, if there is a query that takes a few seconds, all the other calls are pending.
I saw the example you sent me but when I run TUniQuery I can not run another TUniQuery until the first one does not give an answer.
In fact, if there is a query that takes a few seconds, all the other calls are pending.
Re: queries & thread
In order not to wait for SQL query execution completion, you can execute each of them in a separate thread. To ensure thread safety in UniDAC, you should use a separate instance of TUniConnection for each thread. For this, you can create a separate TUniConnection component for each thread in Datamodule and pass its TUniConnection component to each thread, or create a separate TUniConnection instance in each thread in run-time.
To minimize the time for creating TUniConnection instances, you can use UniDAC Connection Pooling. For this, before establishing a connection set TUniConnection.Pooling to True. More information about UniDAC Connection Pooling in our online documentation: https://www.devart.com/unidac/docs/?work_pooling.htm
To minimize the time for creating TUniConnection instances, you can use UniDAC Connection Pooling. For this, before establishing a connection set TUniConnection.Pooling to True. More information about UniDAC Connection Pooling in our online documentation: https://www.devart.com/unidac/docs/?work_pooling.htm
Re: queries & thread
When I manage each query in a separate thread it is indeed possible to run parallel multiple queries.
The problem now is that when there are 200 threads at the same time (when the entire system receives thousands of calls but there are about 200 calls remaining in the air waiting to receive a result and close the thread)
When some run long queries (20 seconds) the system gets stuck.
I manage everything in a dynamic array and despite everything there are blasts - as if some of the thread get stuck.
what can be done?
Maybe the thread is not built for loads?
The problem now is that when there are 200 threads at the same time (when the entire system receives thousands of calls but there are about 200 calls remaining in the air waiting to receive a result and close the thread)
When some run long queries (20 seconds) the system gets stuck.
I manage everything in a dynamic array and despite everything there are blasts - as if some of the thread get stuck.
what can be done?
Maybe the thread is not built for loads?
Re: queries & thread
Please provide the exact error message(s) if you get ones before thread crash/stuck. You can use logging in your application to detect the exact places where errors occur or the sequence of actions that leads to them. Try to get a stable reproduction of the issue and then compose a small test project to demonstrate it. You can send the test project using the contact form on our site: https://www.devart.com/company/contactform.html .