#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    tlu
    Posts
    16
    Rep Power
    0
    Hi
    I have found a nice guestbook scripts and noticed that it reads the whole guestbook data file to a variable and then adds the new enty then appends the variable contents to the file so that new entries will be at the top.
    I modified the script to use flock to avoid lossing and tried to change program to append only the new enty at the top using seek()
    put the data goes at the end of the file. so i left the program as is but I don't know if reading a larg file to memory slows down the server.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    81
    Rep Power
    14
    You'll almost certainly be getting a performance boost from flock()'ing and seek()'ing as it does take a little time to read a file into memory (and then obviously takes up a potentially large amount of space in memory). Realistically, though, unless you're getting a lot of requests and/or have a pretty sizable file (>10k) you probably won't notice much difference -- best way to tell is to run benchmarks on the code to see how it performs. The standard Benchmark.pm module suffices to do this -- check perldoc Benchmark for more information. There could also be issues with using flock() as it is not especially portable and can be slow on systems that use emulation rather than direct support of it. Your best bet really is to run the benchmarks and see what works best for you on your system.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    73
    Rep Power
    14
    It's good for file writing/reading but it would take more RAM of the servers

    Maybe the script needs a better initial design (more smaller files)

    ------------------
    http://new.123finder.com/ - Helps you find cool domains for FREE & Registers it for only $14.95/yr
    http://www.guideclick.com/ - Qualified webmaster resources (affiliate programs, web design, tips)

    ------
    Son

IMN logo majestic logo threadwatch logo seochat tools logo