Re: SWI-Prolog engine as a Service

Sergio Castro <[email protected]> Wed, 23 Apr 2014 02:55:26 -0700 (PDT)
Newsgroups gmane.comp.ai.prolog.swi
Message-ID <[email protected]>
Thanks for your feedback Jan.

Pavan, I have also tried using sockets by means of the PDT-Connector library. Let me know if you want more information about this approach.

Sergio
Le Mercredi 23 avril 2014 9h08, Jan Wielemaker <[email protected]> a écrit :
 
Pavan, Sergio,
>
>On 04/22/2014 11:56 PM, Sergio Castro wrote:
>> If your client is a Java program and you can execute it in the same
>> machine than SWI, I think the best you can do is to try with JPL.
>> Configuring it as a web service in that scenario may add another
>> layer of complexity. Also you would experiment a strong impact on
>> performance.
>
>Yes and no.  As you have experienced, JPL is not without problems.  On Unix
>systems Prolog tends to fight over signals with Java (both needs signals
>for similar thread communication requirements), causing several
>stability problems depending on what you are doing and which JVM you are
>using.  These problems are very hard to diagnose and it is unclear whether
>or not they can be fixed.  Certainly not in a proper JVM-independent way.
>On all platform, merging Prolog and Java suffers from configuration issues.
>Most have to do with wrong paths and merging different architectures (e.g.,
>32 and 64-bit).  They require proper knowledge of dynamic linking and
>dynamic linking debugging tools to fix.  It is hard to provide recipes
>because there are just too many combinations of OS, Prolog and JVM.
>
>Using Prolog as a (web-) service, talking through sockets avoids all this.
>You get socket communication overhead in return.  If you use direct sockets,
>that should be well below 1ms.  If you use HTTP it becomes easier, be the
>price you pay is `a few ms'.  The other advantage is that you have natural
>access to the Prolog toplevel, which makes it easier to debug your program.
>
>I don't see the problem of `starting Prolog as a service': just start Prolog
>and use the http HOWTO/Tutorial to provide the service.  You can start
>Prolog
>by hand separately, or make the Java program fire Prolog.
>
>    Cheers --- Jan
>
>
>>
>> Sergio
>>
>>
>> Le Mardi 22 avril 2014 17h26, Pavan Kumar <[email protected]> a écrit :
>>
>> I have a Java Program that will generate a Query for SWI-Prolog(CLPFD). I
>>> need this query to be sent to SWI-Prolog for further processing and getting
>>> back the results or Output of the SWI-Prolog.
>>>
>>> I figured out JPL is a good approach and also we can try to host SWI-Prolog
>>> engine as a Web Service and send our query which is generated by Java
>>> Program to get back the results.
>>>
>>> I saw a web services section in SWI-Prolog Documentation but it seems like
>>> creating web Servers in SWI-Prolog which serves html pages and http
>>> requests but not the SWI-Prolog Functionality as a Service itself.
>>>
>>> Can you let me know which is the better approach for my problem? JPL or
>>> Hosting SWI-Prolog engine as a service?
>>>
>>> If the latter is better can you guide me how to do it and communicate with
>>> the web service?
>>>
>>> I am using a Windows 8 machine with SWI-Prolog 6.6.4 setup.
>>>
>>> Thanks,
>>> Pavan.
>>> -------------- next part --------------
>>> HTML attachment scrubbed and removed
>>> _______________________________________________
>>> SWI-Prolog mailing list
>>> [email protected]
>>> https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog
>>>
>>>
>>>
>> -------------- next part --------------
>> HTML attachment scrubbed and removed
>> _______________________________________________
>> SWI-Prolog mailing list
>> [email protected]
>> https://lists.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog
>>
>
>
>
-------------- next part --------------
HTML attachment scrubbed and removed