Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Synchronous calls to server? #1

Open
PhilAndrew opened this issue Aug 19, 2019 · 1 comment
Open

Synchronous calls to server? #1

PhilAndrew opened this issue Aug 19, 2019 · 1 comment
Labels
community community Effort - Unknown Effort - Unknown feature feature Frequency - Monthly Frequency - Monthly Reach - VeryFew Reach - VeryFew Severity - S3 Severity - S3

Comments

@PhilAndrew
Copy link

Hi, this looks like its synchronous blocking functions am I right? Then if I wish to make many calls, can I

  1. Do them in parallel threads, is it thread safe?
  2. Should I be doing them in threads, what if I want to run 1000 calls at the same time, 1000 threads?
@tomicm
Copy link
Contributor

tomicm commented Sep 10, 2019

Yes, query functions are synchronous and blocking. If you wish to make many calls in parallel, you can make them from parallel threads. However, you must create a mg_session object per thread, since the objects aren't thread safe, and you must pull all the results before making the next call.

Since you need a separate connection for each mg_session object, the number of calls that you can make in parallel is limited by the maximum number of connections the server is configured to accept.

gitbuda added a commit that referenced this issue Feb 18, 2023
@gitbuda gitbuda self-assigned this Feb 18, 2023
@gitbuda gitbuda added the enhancement enhancement label Aug 31, 2023
@katarinasupe katarinasupe added feature feature community community Severity - S3 Severity - S3 Effort - Unknown Effort - Unknown Importance - I3 Importance - I3 and removed enhancement enhancement labels Dec 29, 2023
@katarinasupe katarinasupe added Frequency - Monthly Frequency - Monthly Reach - VeryFew Reach - VeryFew and removed Importance - I3 Importance - I3 labels Feb 27, 2024
@gitbuda gitbuda removed their assignment Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community community Effort - Unknown Effort - Unknown feature feature Frequency - Monthly Frequency - Monthly Reach - VeryFew Reach - VeryFew Severity - S3 Severity - S3
Projects
Development

No branches or pull requests

4 participants