[fpc-pascal]Databases and FPC
A.J. Venter
ajventer at direqlearn.org
Wed May 7 09:54:04 CEST 2003
On Tue, 2003-05-06 at 12:59, Verity F.M. Brooks wrote:
> The quickest and easiest way would be to make a ramdisc, put the relevant
> files into it and have the programs use that - have another daemon
> synchronise the ramdisk every so often and fit a UPS. If you use a journal
> file system you can just sync what has changed which makes it much quicker.
> That would be a very quick project.
Genius, sheer genius. All I would need to do, is to modify the code
once, so that the database path is changed. Set up a boottime script
which creates a ramdisk, copy the database files into it, and go ahead.
A cron job can then copy the database back to the harrd-drive every 10
minutes or so. All my servers allready have UPS's fitted, and they have
1.5 gig's of ram plus 3gb's of swap, so a 20mb ram disk won't be an
issue.
>
> Another approach, also very easy, is not to bother updating timers all the
> time. Just create a secure log of every use logging in and out - unix does
> this already in wtmp. Then, on a completely different system, run a batch
> job that just reconciles the log file. Then update the users with the final
> totals daily from the log file. wtmp is binary, but you can read it with
> 'last'. I would use awk for that exercise rather than pascal - it is very
> good at that sort of job and easy to code.
>
> Even easier, on linux, is to enable system accounting that does all the work
> for you, then use those totals to update the user times. System accounting
> does have a performance penalty of around 2%, but your program, from the
> sound of it, is likely to be impacting performance by more than that so it
> would be a performance improvement.
Neither of these would work, as the system is meant to be before the
fact time control. I.E. A user buys five minutes, and if after five
minutes he has not bought more, he is automatically logged out, and
cannot log back in until the system is ready for him. The above methods
would be fine for after the fact billing, but in african countries fraud
is so rife, that no internet cafe would ever see a penny if you did not
absolutely have to pay beforehand to work.
--
Story of my life: "Semper in excretum, set alta variant"
A.J. Venter
DireqLearn Linux Guru
More information about the fpc-pascal
mailing list