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

Curl? #141

Open
F21 opened this issue Jul 2, 2013 · 5 comments
Open

Curl? #141

F21 opened this issue Jul 2, 2013 · 5 comments

Comments

@F21
Copy link
Contributor

F21 commented Jul 2, 2013

I noticed that the driver uses fopen instead of curl under the hood.

Is there any particular reason why fopen as chosen as the preferred method? If there's no particular reason, and it is acceptable to allow CURL as a dependency, should we move to using CURL?

@jsteemann
Copy link
Contributor

There are two things to consider:

  • moving to cURL will introduce a new dependency. It don't think this is a big problem as most people will have the curl module installed anyway or can quickly install it.
  • cURL does not support Unix domain sockets, which is ok but will effectively remove the option to connect from PHP to ArangoDB via such socket type.

As mentioned, I think the first obstacle is minor, the impact of the second one depends on the point of view or usage. If no one uses Unix domain sockets for connecting, it can be removed and the move to cURL makes much sense. If people use it a lot (I doubt, as Unix domain sockets are not available on Windows, for example), then the move should probably be announced and then done for some upcoming version.

My personal opinion is that we should move to cURL if we wouldn't have the Unix domain socket option. Because we have it, we should check whether someone objects against moving to cURL. I'd say if no one complains after some period, this can be interpreted as "no complaints".

@F21
Copy link
Contributor Author

F21 commented Jul 2, 2013

I have not actually considered the point about unix sockets as I have been using HTTP exclusively. Since ArangoDB supports sockets, it is something to consider.

Maybe we can refactor the code so that the current interfaces remain the same, but there are options to choose CURL or sockets as the underlying driver?

@frankmayer what do you think?

Would love to hear from other users of the library too. 😄

Personally, for me, I would prefer to drop unix socket support and move to CURL completely. However, I am using ArangoDB over HTTP exclusively. Are there any benefits to using UNIX sockets rather than HTTP?

@frankmayer
Copy link
Contributor

Yes, both points, Jan raised are valid. I looked into Curl, too and it could be done at some point.
But personally, I think we should stay with fopen in this driver versions (1.x) or until the low-level one is out.

Why?
a) It does the Job its supposed to, fine.
b) Introducing curl, would mean that it must be included as an extension in PHP (se Jan's dependency reason)
c) If there is any really important and vital reason to do so? Does it for example have some big performance improvement or such?
d) And of course, sockets. Personally I like sockets on Unix/Linux as they are a lot faster.Haven't yet tested the performance with ArangoDB, yet. However, since it is provided by the API, the driver should support it.

In my local devel environment for the ArangoDB low-level driver I have done some groundwork in making it all pluggable, but haven't decided yet on the final way to go. There are some performance and usability factors to consider and a few tests to run, concerning performance. There are many ways to do it and I want to find the best balance.
In the end you can use whichever mechanism you want. FOpen, Curl, or anything else that you want.

Please bare with me a bit longer, while I still struggle with some other projects, until I can finally devote my time to provide a fine solution in the form of a new low level driver. 😄

@razvanphp
Copy link

I would suggest to think about guzzle too, as it is already included in many API SDKs, like AWS. It seems it also supports unix sockets.

http://mtdowling.com/blog/2014/10/13/guzzle-5/

I think the biggest performance improvement would be if multiple requests are done asynchronous, but I don't know if that's the case with arango API and cursors.

@frankmayer
Copy link
Contributor

Thanks for your input. Have heard of it, but no hands on experience yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants