NetTalk Central

Author Topic: OpenFiles  (Read 3344 times)

JohanR

  • Sr. Member
  • ****
  • Posts: 375
    • View Profile
    • Email
OpenFiles
« on: January 04, 2010, 11:56:20 PM »
Hi,

I have seen in a previous post that I should open and close files as needed,
as I also understand the webserver starts many threads, each for every request.

Would this not create quite a lot of overhead with opening and closing of files?

Is there a way to open the files when the webserver starts and keep them open?
Or would this extra overhead of opening and closing a file be small compared to the creation of a new thread for every request?

TIA for any feedback

Johan








Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: OpenFiles
« Reply #1 on: January 05, 2010, 03:32:15 AM »
Hi Johan,

The way clarion works you can't "open" a file on one thread and have it "open" on all threads. It's possible that if it _is_ open on the main thread then it opens faster on other threads, I'm not sure of that. Personally I wouldn't think that's such a good idea though.

Bear in mind that this is all happening in Ram, and your machine is plenty quick. Opening and closing files is not really that expensive.

Also remember that not all files are opened for every thread. Actually it's a very small number, if any, that are opened.

So, I'm thinking that unless you have some data t the contrary, this just isn't something you need to be worried about.

cheers
Bruce