Recent

Author Topic: Use FreePascal for develop RESTFul services  (Read 2224 times)

Fossy

  • New Member
  • *
  • Posts: 22
Use FreePascal for develop RESTFul services
« on: March 26, 2019, 12:32:09 pm »
Hello:

I have much experience developing compiled CGI's with FreePascal, and now I want to develop an RESTFul service for mobiles apps.

Develop it is not problem, I want to know if is an good idea FreePascal instead PHP. I know that compiled CGI es much more fast than interpreted languages, but I know (by example) that PHP uses cache techniques and have integration with Apache. I think that CGI compiled load in memory one time and executes from there all times/app petitions, but I'm not sure.

What's your opinion?.

Thaks!!.

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Use FreePascal for develop RESTFul services
« Reply #1 on: March 26, 2019, 12:57:29 pm »
Develop it is not problem, I want to know if is an good idea FreePascal instead PHP. I know that compiled CGI es much more fast than interpreted languages, but I know (by example) that PHP uses cache techniques and have integration with Apache.

You can use cache techniques yourself and you can compile your program as an Apache modules instead of a CGI one. See the wikipage: FPC and Apache Modules

Quote from: Fossy
I think that CGI compiled load in memory one time and executes from there all times/app petitions, but I'm not sure.

No. A CGI program is normally run each time it's needed; FastCGI is what you're thinking about, and you can do those with FPC too.

For more info, start from the wiki Web Development Portal
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8746
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Use FreePascal for develop RESTFul services
« Reply #2 on: March 27, 2019, 06:23:48 pm »
I want to know if is an good idea FreePascal instead PHP
Largely a preference problem, i.e. not a problem.
I know that compiled CGI es much more fast than interpreted languages
Assuming the interpreted languages are executed in CGI way as well, largely yes. Otherwise, it might not (i.e. a long running interpreter service may be able to execute faster).
but I know (by example) that PHP uses cache techniques
Not activated by default.
and have integration with Apache.
As does FPC.
I think that CGI compiled load in memory one time and executes from there all times/app petitions, but I'm not sure.
OS dependent, but in general yes.
What's your opinion?.
Until you come up with a problem that matters a language selection, doing with any is just fine. For instance, if you want your app to easily take advantage of the number of processor cores, you're unlikely to do it by exploiting threads in PHP, but very likely with FPC. You will solve the scaling problem in PHP by spawning more worker service instead.

Fossy

  • New Member
  • *
  • Posts: 22
Re: Use FreePascal for develop RESTFul services
« Reply #3 on: March 28, 2019, 01:21:48 pm »
Thanks Lucamar and Leledumbo!.

Very interesting your answers. I like the Lucamar option to compile source code as Apache module. Will give me speed, only one instance loaded in memory, and internal cache techniques implemented by Apache/Nginx by default.

At this point, I have read the link and I compiled the test .so hello world. I can load module in Apache, but I can't find how execute the code accessing to domain or parameter..., I'm lost here. How I can view the hello world test?.

I can convert an CGI application in to Apache module as an easy way?, or I need to write all code related to handle, hook...?.

Thanks!!

ASBzone

  • Hero Member
  • *****
  • Posts: 678
  • Automation leads to relaxation...
    • Free Console Utilities for Windows (and a few for Linux) from BrainWaveCC
Re: Use FreePascal for develop RESTFul services
« Reply #4 on: April 25, 2019, 07:38:38 pm »
At this point, I have read the link and I compiled the test .so hello world. I can load module in Apache, but I can't find how execute the code accessing to domain or parameter..., I'm lost here. How I can view the hello world test?.

I can convert an CGI application in to Apache module as an easy way?, or I need to write all code related to handle, hook...?.

Thanks!!


Have you seen this?  [size=78%]https://httpd.apache.org/docs/2.4/developer/modguide.html[/size]
-ASB: https://www.BrainWaveCC.com/

Lazarus v2.2.7-ada7a90186 / FPC v3.2.3-706-gaadb53e72c
(Windows 64-bit install w/Win32 and Linux/Arm cross-compiles via FpcUpDeluxe on both instances)

My Systems: Windows 10/11 Pro x64 (Current)

 

TinyPortal © 2005-2018