Run A Procedure (.r) Compiled In Unix Inside A Webspeed Program

maretix

Member
Hi to all.
I use an ERP written in OpenEdge PROGRESS 10.2b over a UNIX AIX Server.
I use WEBSPEED in a Windows server with the same version OpenEdge Progress 10.2b

I need to call a procedure written in our ERP on UNIX , inside a WebSpeed program.
I need to do something like RUN <myprocedure.p>
I'd like not to compile this procedure over Windows Server ...
I just did it , and when i ran the procedure is very slow... i need to improve performances ...

So i tried to run UNIX R-Code , but i think with 10.2b version it is not possibile to run same procedure (.r) with the same .r code in different platforms ...i receive this error...
(I read it will be possibile with 11 version of OpenEdge).

16/07/08@16:20:11.641+0200] P-004472 T-002004 1 WS -- (Procedure: 'setQuery btob/wsp_btob_cli_prz.r' Line:7684) Versione non valida 17391 (prevista 1005) nel file oggetti C:\OpenEdge\WRK\apps\mosaico\files\yprezzo.r. (2888)

So my definitive question is :

How can i run a .p procedure inside a WebSpeed program if the procedure .p is external to the server where Webspeed is running ???

I am newbie about APPServer or Socket or something else could solve my problem...

Sorry if i asked this ... but other times in this very useful blog i found good advices and solutions.

Regards in advance.

 

RealHeavyDude

Well-Known Member
R-files are plattform independent as long as the source code does not contain plattform specific code ( like visualizations in .w files which are specific to Windows ). But, in OpenEdge 10 ( and Progress V9 ) the bitness ( 32Bit or 64Bit ) does matter: You can only run 64Bit compiled r-code in a 64Bit version of Progress. That limitation was lifted in OpenEdge 11.

You are trying to run a 64Bit r-file in a 32Bit version of OpenEdge 10. That you can't do in OpenEdge 10.

The only way to run an ABL procedure that is in a different session ( or on a another machine for that matter ) is to use the AppServer. For that you need to have the AppServer license installed on the other machine - plus you need to have the AppServer you need up & running.

BUT: If you can run the source code in your WebSpeed session ( which automatically gets compiled on-the-fly in order to get executed ) then you can compile the program for 32Bit and run it directly in the WebSpeed session.

What is the reason that you don't want to compile the program?

Is the Windows WebSpeed Broker connected to the very same database on the Unix machine?
The reason that I am asking is that, if that is the case, your performance issue might not come from the on-the-fly compilation, but from the programm on the Unix machine utilizing a shared memory connection whereas on the Windows machine it utilizes a remote connection over the network.

Heavy Regards, RealHeavyDude.
 

maretix

Member
R-files are plattform independent as long as the source code does not contain plattform specific code ( like visualizations in .w files which are specific to Windows ). But, in OpenEdge 10 ( and Progress V9 ) the bitness ( 32Bit or 64Bit ) does matter: You can only run 64Bit compiled r-code in a 64Bit version of Progress. That limitation was lifted in OpenEdge 11.

You are trying to run a 64Bit r-file in a 32Bit version of OpenEdge 10. That you can't do in OpenEdge 10.

The only way to run an ABL procedure that is in a different session ( or on a another machine for that matter ) is to use the AppServer. For that you need to have the AppServer license installed on the other machine - plus you need to have the AppServer you need up & running.

BUT: If you can run the source code in your WebSpeed session ( which automatically gets compiled on-the-fly in order to get executed ) then you can compile the program for 32Bit and run it directly in the WebSpeed session.

What is the reason that you don't want to compile the program?

Is the Windows WebSpeed Broker connected to the very same database on the Unix machine?
The reason that I am asking is that, if that is the case, your performance issue might not come from the on-the-fly compilation, but from the programm on the Unix machine utilizing a shared memory connection whereas on the Windows machine it utilizes a remote connection over the network.

Heavy Regards, RealHeavyDude.


Hi RealHeavyRude , first of all many thanks for your kin reply.

I think you understood very good my problem.

According your answer i can :

1) Install Opend EDGE 11.xyz VERSION on a new Windows server machine, (it should be a new WebSpeed server ),,, to override any problems about r-code versions. :)..
(But i do not know , if i will can do that)
Besides i think i will have same problems of performances ..
You correctly said: "your performance issue might not come from the on-the-fly compilation, but from the programm on the Unix machine utilizing a shared memory connection whereas on the Windows machine it utilizes a remote connection over the network."

2) If i cannot change server Windows and OpenEdge Version... i think you are right... i have to use APP SERVERS ...
I never used an APP SERVER so i will need help of someone more expert than me....
In Windows Server where i have WEBSPEED , in Progress Open Edge Explorer ,where i configured WEBSPEED BROKERS , i can see APP SERVER so i think i can configure them from here (How i have to study about them...)
In UNIX Server ..i do not know ...i need to inform about this..

Do you have any documentation about "RUN AN ABL PROCEDURE using APPSERVER ???"

To answer your doubt, i just did compilation of <myprocedure.p> program in Windows Environment.
I stored <myprocedure.r> in a folder and i put this folder in BROKERS's Propath.
It works good , and this it is my best solution.
The problem is that this WebSpeed URL , run slowly cause of this <myprocedure.p>
So i was asking an alternative mode , to run with more performances...
<myprocedure.p> is a .p very complicated to calculate a customer price ...
In my WEBSPEED application i just i put RUN <myprocedure.p>
(an URL that is requested by a thidy party that maintain our BTOB Web Site,,pass customer code and a list of products,,,generating a XML file ...)

This is the reason for my thread. o_O

I think problems of performances are that you said : "
"your performance issue might not come from the on-the-fly compilation, but from the programm on the Unix machine utilizing a shared memory connection whereas on the Windows machine it utilizes a remote connection over the network."

I f you have any suggestions about APPSERVER , i will be very happy to read them...

PS. I have a UNIX Server where is running an ERP in OPENDEDGE Unix 10.2B.
I have a WINDOWS Server where is running WEBSPEED where are running procedures for BTOB-BTOC Web Sites...

Thanks in advance.
 

maretix

Member
Hi RealHeavyRude , first of all many thanks for your kin reply.

I think you understood very good my problem.

According your answer i can :

1) Install Opend EDGE 11.xyz VERSION on a new Windows server machine, (it should be a new WebSpeed server ),,, to override any problems about r-code versions. :)..
(But i do not know , if i will can do that)
Besides i think i will have same problems of performances ..
You correctly said: "your performance issue might not come from the on-the-fly compilation, but from the programm on the Unix machine utilizing a shared memory connection whereas on the Windows machine it utilizes a remote connection over the network."

2) If i cannot change server Windows and OpenEdge Version... i think you are right... i have to use APP SERVERS ...
I never used an APP SERVER so i will need help of someone more expert than me....
In Windows Server where i have WEBSPEED , in Progress Open Edge Explorer ,where i configured WEBSPEED BROKERS , i can see APP SERVER so i think i can configure them from here (How i have to study about them...)
In UNIX Server ..i do not know ...i need to inform about this..

Do you have any documentation about "RUN AN ABL PROCEDURE using APPSERVER ???"

To answer your doubt, i just did compilation of <myprocedure.p> program in Windows Environment.
I stored <myprocedure.r> in a folder and i put this folder in BROKERS's Propath.
It works good , and this it is my best solution.
The problem is that this WebSpeed URL , run slowly cause of this <myprocedure.p>
So i was asking an alternative mode , to run with more performances...
<myprocedure.p> is a .p very complicated to calculate a customer price ...
In my WEBSPEED application i just i put RUN <myprocedure.p>
(an URL that is requested by a thidy party that maintain our BTOB Web Site,,pass customer code and a list of products,,,generating a XML file ...)

This is the reason for my thread. o_O

I think problems of performances are that you said : "
"your performance issue might not come from the on-the-fly compilation, but from the programm on the Unix machine utilizing a shared memory connection whereas on the Windows machine it utilizes a remote connection over the network."

I f you have any suggestions about APPSERVER , i will be very happy to read them...

PS. I have a UNIX Server where is running an ERP in OPENDEDGE Unix 10.2B.
I have a WINDOWS Server where is running WEBSPEED where are running procedures for BTOB-BTOC Web Sites...

Thanks in advance.


I add also that yes, Windows WebSpeed Broker are connected to the very same database on the Unix machine
So i think you are right... Probably my problem is due from the programm on the Unix machine utilizing a shared memory connection whereas on the Windows machine it utilizes a remote connection over the network.

Thanks again.
 

TheMadDBA

Active Member
The difference between client server and shared memory can be quite drastic for any non trivial code. Assuming you have the proper licenses on the Unix machine setting up an appserver and connecting to it is pretty simple really.

The documentation has quite a few examples on how to do this. Basically you connect to the appserver... setting a handle and then you run your procedure in/on that handle... then you disconnect.
 

maretix

Member
The difference between client server and shared memory can be quite drastic for any non trivial code. Assuming you have the proper licenses on the Unix machine setting up an appserver and connecting to it is pretty simple really.

The documentation has quite a few examples on how to do this. Basically you connect to the appserver... setting a handle and then you run your procedure in/on that handle... then you disconnect.

Thank yu very much for your kind answer-
I will try to find documentation about it.
Thanks again.
 

maretix

Member

Thank you very much !!!!
I will read together my system administrator db collegue.
Besides i think i found a sample to connect to APPSERVER and run <myprocedure.p> on this APPSERVER.
Now i will see if we will be able to install an APPSERVER on UNIX or install new Openedge Version 11.xyz on a new Windows server.
Will see it will depend on my works collegue...
Thanks again.
 

maretix

Member
Thank you very much !!!!
I will read together my system administrator db collegue.
Besides i think i found a sample to connect to APPSERVER and run <myprocedure.p> on this APPSERVER.
Now i will see if we will be able to install an APPSERVER on UNIX or install new Openedge Version 11.xyz on a new Windows server.
Will see it will depend on my works collegue...
Thanks again.

If we will be able to installa an APPSERVER , after to test it works or not , i found this useful example.
Is it right ???
Another question , if i run "RUN count.p ON hAppSrv." on APPSERVER xyz ,, procedure count.p will be used UNIX version o i need tocompile count,p in my Webspeed Server...or it is possibile to set a propath behind APP SERVER...


DEFINE VARIABLE hAppSrv AS HANDLE NO-UNDO.
DEFINE VARIABLE ret AS LOGICAL NO-UNDO.

DEF TEMP-TABLE htable LIKE customer.

CREATE SERVER hAppSrv.

ret = hAppSrv:CONNECT("-AppService asbroker1 -H localhost -S 5162","","").

IF NOT ret THEN
RETURN ERROR "Failed to connect to AppServer".
ELSE
DO:
MESSAGE "connected to appserver" VIEW-AS ALERT-BOX.
RUN count.p ON hAppSrv.
RUN disconn.p ON hAppSrv.
END.

ret = hAppSrv:DISCONNECT().

DELETE OBJECT hAppSrv.

=============================
disconn.p

DISCONNECT prog91d.
 

RealHeavyDude

Well-Known Member
  • In order to be able to install the AppServer on the Unix system you need to have a license. If you have WebSpeed already on the Unix server then you already have the AppServer too - it is the same license. Your Windows WebSpeed license on the other hand won't do on Unix.
  • When configuring the AppServer on Unix to connect to the database on the same system, be sure to use a shared memory connection - NOT a remote connection specifying -H and -S!
  • Running a procedure on the AppServer is like calling a remote procedure. The procedure runs on the system wherer the AppServer resides and the AppServer needs the procedure in its PROPATH. Therefore, if the AppServer resides on Unix you will run the 64Bit Unix version of it that resides on the Unix system somewhere in the PROPATH of the AppSserver. The PROPATH of the WebSpeed Broker and AppServer - when running on different serverns - are two completely different settings, one does not inherit from each other. They are completely atomic from this point of view.
  • The example you ( please use code tags in the future when posting ABL code - it makes it much easier to read ) posted is the most basic example on how to connect to an AppServer and run a procedure. Two remarks from my side:
    • First, think about whether you need to establish a new connection on every AppServer call or whether you can keep the connection so that subsequent calls are avoiding the connection. Establishing the connection is rather costly. Your AppServer should be at least running state-less or state-free.
    • Be sure to delete any handle-based object that you instantiate with the CREATE statement. Otherwise you might end up producing a memory leak.
Heavy Regards, RealHeavyDude.
 

maretix

Member
  • In order to be able to install the AppServer on the Unix system you need to have a license. If you have WebSpeed already on the Unix server then you already have the AppServer too - it is the same license. Your Windows WebSpeed license on the other hand won't do on Unix.
  • When configuring the AppServer on Unix to connect to the database on the same system, be sure to use a shared memory connection - NOT a remote connection specifying -H and -S!
  • Running a procedure on the AppServer is like calling a remote procedure. The procedure runs on the system wherer the AppServer resides and the AppServer needs the procedure in its PROPATH. Therefore, if the AppServer resides on Unix you will run the 64Bit Unix version of it that resides on the Unix system somewhere in the PROPATH of the AppSserver. The PROPATH of the WebSpeed Broker and AppServer - when running on different serverns - are two completely different settings, one does not inherit from each other. They are completely atomic from this point of view.
  • The example you ( please use code tags in the future when posting ABL code - it makes it much easier to read ) posted is the most basic example on how to connect to an AppServer and run a procedure. Two remarks from my side:
    • First, think about whether you need to establish a new connection on every AppServer call or whether you can keep the connection so that subsequent calls are avoiding the connection. Establishing the connection is rather costly. Your AppServer should be at least running state-less or state-free.
    • Be sure to delete any handle-based object that you instantiate with the CREATE statement. Otherwise you might end up producing a memory leak.
Heavy Regards, RealHeavyDude.
Thank you very much RealHeavyDude.
Today i will try with my work collegue to install and configuring an APPSERVER on our test UNIX server ...
Then i will try to modifiy webspeed application to invoke my procedure with statement RUN <myprocedure> ON <name of appserver>

I will be very carefully to delete any handle-base object that i will instantiate with the CREATE statement.
To configure APPSERVER in state -less or state-free mode will see how to do it.

Thank you very much !!!!
Now i have only to work and test.
I will inform you about testing...
I hope in this way to improve performances ..
Regards.
 

maretix

Member
Thank you very much RealHeavyDude.
Today i will try with my work collegue to install and configuring an APPSERVER on our test UNIX server ...
Then i will try to modifiy webspeed application to invoke my procedure with statement RUN <myprocedure> ON <name of appserver>

I will be very carefully to delete any handle-base object that i will instantiate with the CREATE statement.
To configure APPSERVER in state -less or state-free mode will see how to do it.

Thank you very much !!!!
Now i have only to work and test.
I will inform you about testing...
I hope in this way to improve performances ..
Regards.

After your very useful help , i was able to installa an APPSERVER,,,
Using APPSERVER i was able to reuse my ERP'S business logic inside a WebSpeed CGI Wrapper.
Performance are very good ...
Before using APPSERVER , i was forced to run a program (.r) inside my WebSpeed Server.
The same program running on APPSERVER run 5 time faster...
(Logic is about calculate a customer price for block of 15 products together)

Thanks again for your support and also to TheMad DBA advices...

Regards.
 
Top