Forum > Networking and Web Programming

fptemplate | Bug

(1/2) > >>

cpalx:
Some weeks before I made a webside using lazarus + CGI + fptemplate, it was perfectly the first days, but when i had 6000 visitors by day i had the problem:

Error: Unable to open file "template/admin.main.list.item.html"

where the file "template/admin.main.list.item.html" was my template file. I suppose it was two(or more) visitors open the websides (The file) simultaneous.

Leledumbo:
The file was opened using fmOpenRead mode only, I think it should be opened with fmShareDenyWrite as well.

Trenatos:
If the file doesn't change, consider caching it and only loading it from disk if the modified timestamp has changed, it'll be faster and won't have file-lock issues.

cpalx:
and how i make it that with fptemplate

Thaddy:
This is not a limitation of the template engine, but you are probably hitting a limitation of cgi itself, which starts a new process for every connection.
You can do two things:
1. include the template as a resource in the cgi
2. Change to fastcgi, which keeps the same process for every connection.

There are more ways to solve this, but cgi has its problems if the website itself has no means to distribute its load.

Running 6000 processes at the same time on a single server is asking for trouble.... So consider option 2 if you are on a limited budget. Or try to limit the liveliness of a single connection to the cgi part of your web app..

In other words: cgi does not scale well on a single server. Fastcgi or e.g. an apache module scales better. Also note fastcgi is not necessarily fast, but at least it is likely to be more responsive for clients under single servers with high load.

Navigation

[0] Message Index

[#] Next page

Go to full version