Hoi RGJ,
Gisteren begonnen met het (her)ontwerpen van de infrastructuur databases voor de demon foonsearchd.exe:
- application
- download
- fsdb
- logdb
- peer
- queue
- scheduler
- security
- systemdb
- tempdb
Als eerste ga ik met, de ‘motor’ van de demon, de ‘scheduler’ database aan het werk. Ik ga 4 tabellen gebruiken, namelijk ‘cron’, ‘master’, ‘ArcCron’ en ‘ArcMaster’. Het verschil tussen ‘cron’ en ‘master’ is dat in de master tabel de records staan die in de tijd herhaald worden. In ‘cron’ de records zetten die een beperkte tijdhorizon hebben. Denk aan 15 minuten. Als je een herhalingsrecord in ‘cron’ zet dan zal de demon hem in ‘master’gaan zetten en de record ‘verwijderen’ uit cron door hem in ‘ArcCron’ te kopiëren.
In veld “Type” kan je kiezen om een executable of een interne procedure in veld “exe” uit te voeren. Denk bij aan interne procedure “wget” of “syncDatabase”. In veld “RunTime” komt hoeveel seconden het heeft geduurd. Het veld “RunTimVar” zet je de parameters die belangrijk zijn voor “RunTime”. Bijvoorbeeld het aantal bytes van de “file” en download/upload snelheid van de verbinding bij “wget”. Je kan dan met factoranalyse de RunTime tijdsduur in de toekomst bepalen als je nog een keer zo’n routine gaat aanroepen. De interne routines ook hashcodes gaan geven. Je kan dan gemakkelijk zien of een verbeterde databasesynchronisatie procedure echt sneller werkt.
Mijn huidige denkrichting: Met SQLyog insert je een record in master/cron. De demon kijkt (d.m.v. timer) elke 10 seconden of er een nieuwe record in master/cron zit. Zo, ja dan vult hij de gegevens aan. Hij zet bijvoorbeeld timestamp (“tsetBegin”) om met UNIX_TIMESTAMP(‘2005-03-27 03:00:00’) in 1111885200 (“tsetBeginSec”).
Hierna controleren of er een “tsetBeginSec” is die binnen 15 minuten uitgevoerd moet worden. Zo ja, dan een workerthread aanmaken die op gewenste tijdstip afgaat.
De andere threads (packets binnenhalen, verwerking van de udp packets) ook vanuit de scheduler (automatisch) gaan starten bij het opstarten van de demon. Je kan ze dan ook handmatige gaan uitzetten met de GUI (SQLyog).
De hartelijke groet Jan Marco
Appendix MySQL cron definitie:
[quote]create table cron ( #02 - deze tabel gaan synchoniseren met andere remote peers.
ts timestamp,
id bigint(16) unsigned not null,
importance bigint(15) not null default 0,#The current rating of this content.
priority bigint(15) not null default 0,#How important is this content for the end-user
peerId varchar(255) not null default’’,
peerIdExecute varchar(255) not null default’’,
ticket varchar(255) not null default’’,
type varchar(255) not null default’’,#native, batch, direct, startup, service
tsetBegin timestamp,
tsetEnd timestamp,
tsetBeginSec bigint(15) not null default 0,
tsetEndSec bigint(15) not null default 0,
exe varchar(255) not null default’’,
hashExe varchar(255) not null default’’,
cmdLine varchar(255) not null default’’,
domainName varchar(255) not null default’’,# "WORKGROUP"
userName varchar(255) not null default’’,# test01
password varchar(255) not null default’’,# test01
desktop varchar(255) not null default’WinSta0\Default’,# WinSta0\Default
createTokenDirectly bigint(10) not null default 0,# 0
tSession bigint(10) not null default -1,# -1
loadProfile bigint(10) not null default 0,# 0
copyTokenPropFromCaller bigint(10) not null default 0,# 0
keepPriv bigint(10) not null default 1,# 1
logonType bigint(10) not null default 2,# 2
logonProvider bigint(10) not null default 0,# 0
repeatSeconds bigint(10) not null default 0,
repeatCount bigint(10) not null default 0,
repeatDayOfWeek bigint(10) not null default 0,
threadId varchar(255) not null default’’,
runTime bigint(10) not null default 0,
runTimeVar varchar(255) not null default’’,
resultcode bigint(10) not null default 0,
hashSincFields varchar(255) not null default’’,
fsSinc varchar(255) not null default’’,
hash varchar(255) not null default’’,
hashUpdate varchar(255) not null default’’,
updateEntry timestamp,
beginEntry timestamp,
endEntry timestamp,
owner varchar(255) not null default’’,
recordCheck bigint(10) not null default 0,
status varchar(255) not null default’’,
action varchar(255) not null default’’,
index (importance),
index (priority),
index (peerId(16)),
index (peerIdExecute(16)),
index (ticket(16)),
index (type(16)),
index (tsetBegin),
index (tsetEnd),
index (exe(16)),
index (hashExe(16)),
index (cmdLine(16)),
index (domainName(16)),
index (userName(16)),
index (password(16)),
index (desktop(16)),
index (createTokenDirectly),
index (tSession),
index (loadProfile),
index (copyTokenPropFromCaller),
index (keepPriv),
index (logonType),
index (logonProvider),
index (repeatSeconds),
index (repeatCount),
index (repeatDayOfWeek),
index (threadId),
index (runTime),
index (runTimeVar(16)),
index (resultcode),
index (hashSincFields(16)),
index (fsSinc(16)),
index (hash(16)),
index (hashUpdate(16)),
index (updateEntry),
index (owner(16)),
index (recordCheck),
index (ts),
primary key (id)
) type=myisam;[/quote]