FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index mod_harbour The post *“FWH 26.03 is probably the best FWH built ever…”* motivated me to ask an AI a specific question
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
The post *“FWH 26.03 is probably the best FWH built ever…”* motivated me to ask an AI a specific question
Posted: Thu Mar 26, 2026 10:00 PM

Would refactoring mod_harbour from CGI to module mode significantly improve performance?

👉 Can the 500 ms per request in a mod_harbour CGI setup be eliminated “easily”?
👉 And if so – how much effort would it take?

The summarized answer was quite clear:


---

🧠 Root cause

The 400–500 ms are not caused by Harbour code, but by the CGI model itself:

  • new process per request
  • runtime + modules loaded every time
  • PRG possibly compiled at runtime

---

💡 Suggested approach

👉 Move away from CGI → use mod_harbour as an Apache module

  • use SetHandler harbour instead of cgi-bin
  • runtime stays in memory (no process startup per request)
  • optional: precompile .prg.hrb

---

Expected impact

  • current: 400–500 ms
  • after change: 5–20 ms

---

🔧 Effort

Surprisingly manageable:

  • adjust Apache configuration
  • change URLs (/cgi-bin/... → direct /file.prg)
  • code mostly unchanged
  • optional cleanup (remove CGI-specific parts)

👉 Estimated effort: hours rather than days


---

⚠️ One important difference

With mod_harbour, the environment becomes persistent:

  • memory is not reset between requests
  • global/static variables remain

This needs to be considered (unlike CGI where everything is reset each time).


---

🤔 Question to the community

Has anyone already switched from CGI to mod_harbour (module mode)?

  • What response times did you observe?
  • Any issues with persistent state / memory?
  • Is anyone using .hrb instead of .prg in production?

---

To me, this looks like a large performance gain with relatively low effort, before considering bigger architectural changes (like microservices).

Curious to hear your experiences 🙂

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: The post *“FWH 26.03 is probably the best FWH built ever…”* motivated me to ask an AI a specific question
Posted: Thu Mar 26, 2026 10:47 PM

Dear Otto,

Thats totally wrong and I am talking from my use experience. I can explain you why I am saying this.

What AI have you used for this ? Don't trust it.

IMO, the best tool you can use is HIX from Charly. I suggest you to make some tests with it and compare times.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: The post *“FWH 26.03 is probably the best FWH built ever…”* motivated me to ask an AI a specific question
Posted: Fri Mar 27, 2026 12:06 AM

Dear Antonio, thanks for your feedback – much appreciated. You are right to be cautious with AI answers, that’s exactly why I asked here before making any changes. Best regards, Otto

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: The post *“FWH 26.03 is probably the best FWH built ever…”* motivated me to ask an AI a specific question
Posted: Fri Mar 27, 2026 12:32 AM

Dear Otto,

We used mod_harbour to build a web app used by lots of users at the same time.

We found that the Apache memory was not properly released reaching a point where Apache was crashing. Then we turned the same code into a CGI app and Apache properly stabilized. But as you have seen CGI is not the fastest solution.

IMO and based on Charly's tests, HIX is the most stable and fastest. Anyhow, I would recomend to test it for yourself.

best regards

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: The post *“FWH 26.03 is probably the best FWH built ever…”* motivated me to ask an AI a specific question
Posted: Fri Mar 27, 2026 06:59 AM

Dear Antonio,

thank you for sharing your experience – this is very helpful.

I understand your point regarding the memory issues in a persistent mod_harbour setup. It makes sense that CGI solved the stability problem, even if it comes with a performance cost. So I can clearly see why you ended up with that approach.

Regarding HIX: I do not doubt your assessment about performance and stability.

However, for my situation I have an additional requirement. For the new software line, I need a solution with a clear long-term perspective in terms of ownership, maintenance and availability of the core source code. This means either an established company behind it or a fully open-source solution.

Since the core of HIX is not open source, this is unfortunately not an option for me.

For that reason, I am currently moving forward with my own microservice approach, where I have full control over the complete stack and its evolution. It may not be as optimized out of the box, but it gives me the level of control I need.

Thanks again for your insights – they helped me better understand the trade-offs.

Best regards, Otto

Continue the discussion