Due to timing issues, sometimes early hits from the bout arrive later than the later hits.
If these are simply appended to the list of scores, then the last score to be written to -status.js would be applied to a recovered bout. And we want the last bout recorded, not the last bout received by PHP.
So - will freezing out the user input until the hit is recorded fix this? Yes.
Would freezing out user input for a second fix this? Yes.
Would putting the scores into an array of scores, indexed by a score-input counter fix this? Definitely.
So currently the scores are sent as the current score for [fencer1][fencer2] and [fencer2][fencer1]
Continue doing that, as at present.
When you send an updated score, send an increment number.
When you store the updated score (append it to -status.js) store them into an array of current bout's scores.
When restarting a recovered incomplete bout, find the current score that has the largest increment number, and use it.
If the current bout is unstarted, then no change from current code.
If the current bout is complete, no change from current code.
So - send to getScores.php
getScores.php
change in -status.js format to include increment number
Showing posts with label ClubKnight. Show all posts
Showing posts with label ClubKnight. Show all posts
Sunday, 25 October 2015
Saturday, 24 October 2015
ClubKnight Dev->Production, Mk1
There are three configurations for ClubKnight
1) Development
2) Test
3) Production
Production holds the production code in
/web_root/trial/
/templates/ holds the .phtml files
orgs.php
/<orgs>/<competitions>
1) Development
2) Test
3) Production
Production holds the production code in
/web_root/trial/
/templates/ holds the .phtml files
orgs.php
/<orgs>/<competitions>
Clubknight Perforrmance on Mongoose
Clubknight is sometimes slow to response
Currently, the response comes in from the 'net,
Mongoose serves up the .php page for the pool
it requests the ancillary files from the server disk
so... net to pc, mongoose uses PHP to assemble the page, which then calls the ancillaries - .css, .js - from the NAS drives
Sometimes this can take up to 6-7 seconds total.
Firefox breaks the timings down to:
650ms to 6secs to assemble the PHP page
~300ms start to end for all the ancillaries, which all happen in parallel
Moving the files to the local SSD was meant to speed things up enormously, by doing away with the disk spin-up period in the assembly of the initial PHP web page
But.... it didn't
It is very slightly *slower* to pull from the local SSD than from the NAS drive across the intranet
So.... time to find a faster server than Mongoose?
Perhaps that will help with the PHP log append issue.
If the server becomes more responsive, then that should make any intrusion from a waiting graphic less intrusive.
A trial of LightTPD served a static file in 22ms
Currently, the response comes in from the 'net,
Mongoose serves up the .php page for the pool
it requests the ancillary files from the server disk
so... net to pc, mongoose uses PHP to assemble the page, which then calls the ancillaries - .css, .js - from the NAS drives
Sometimes this can take up to 6-7 seconds total.
Firefox breaks the timings down to:
650ms to 6secs to assemble the PHP page
~300ms start to end for all the ancillaries, which all happen in parallel
Moving the files to the local SSD was meant to speed things up enormously, by doing away with the disk spin-up period in the assembly of the initial PHP web page
But.... it didn't
It is very slightly *slower* to pull from the local SSD than from the NAS drive across the intranet
So.... time to find a faster server than Mongoose?
Perhaps that will help with the PHP log append issue.
If the server becomes more responsive, then that should make any intrusion from a waiting graphic less intrusive.
A trial of LightTPD served a static file in 22ms
Clubknight server configuration, Mk2
The server is now:
M:\<etc>\gawainDev - Dev
M:\<etc>\gawain - Test
M: Mongoose is now on port 8080
The clubknight splash page sends the user to the D: Mongoose,
so you have to manually add the :8080 into the url again
D:\<etc>\trial is on port 80 - Production
M:\<etc>\gawainDev - Dev
M:\<etc>\gawain - Test
M: Mongoose is now on port 8080
The clubknight splash page sends the user to the D: Mongoose,
so you have to manually add the :8080 into the url again
D:\<etc>\trial is on port 80 - Production
Tuesday, 20 October 2015
Referee architecture
getBout.php - which bout are we on
getScores.php - the latest current score in the current bout
getResults.php - all the latest info at the End of the Bout
gawainDev is the dev area
gawain is the testing area
clubknight-trial is pre-production
trial is (currently) production
Each of them uses their own Organisation lists
getScores.php - the latest current score in the current bout
getResults.php - all the latest info at the End of the Bout
gawainDev is the dev area
gawain is the testing area
clubknight-trial is pre-production
trial is (currently) production
Each of them uses their own Organisation lists
Tuesday, 13 October 2015
Next ClubKnight step
Fix the out-of-order hit recording
=======================
a) Place a pause at the client end between each hit recorded
b) Store the hits into a PHP array as they arrive.
Do not log hits if they arrive after later hits which have already been logged
http://www.w3schools.com/php/php_sessions.asp on how to persist data between invocations of a script
or store the sequence number into SQLite rather than a session store, or into CouchDB
c) Store the hits as an array in Javascript in the client, and store the index/sequence number in status, so they are restored to the recorded-order, and not the logged order
Eliminate part-recorded data
===================
1) Hardware
a) Stop using the NAS, start using local hard disc
b) Start using local SSD to speed things up
2) Upgrade to PHP 5.5.30
Does this fix it?
NO.
3) Change from
fopen()
fwrite()
fclose()
to
file_put_contents($file, $data, FILE_APPEND | LOCK_EX);
This also incorporates flock()
Provide Gawain Audience.
==================
List pools on a separate competition page
These pools go to pages which do not have Boutlist or Bout divs accessible (or perhaps not even included)
Next enhancement: search by fencer name, and get a list of links to only relevant pools.
Gawain BigScreen
=============
A list of which pool each fencer has been assigned to, and their referee
to display in alphabetical order
=======================
a) Place a pause at the client end between each hit recorded
b) Store the hits into a PHP array as they arrive.
Do not log hits if they arrive after later hits which have already been logged
http://www.w3schools.com/php/php_sessions.asp on how to persist data between invocations of a script
or store the sequence number into SQLite rather than a session store, or into CouchDB
c) Store the hits as an array in Javascript in the client, and store the index/sequence number in status, so they are restored to the recorded-order, and not the logged order
Eliminate part-recorded data
===================
1) Hardware
a) Stop using the NAS, start using local hard disc
b) Start using local SSD to speed things up
2) Upgrade to PHP 5.5.30
Does this fix it?
NO.
3) Change from
fopen()
fwrite()
fclose()
to
file_put_contents($file, $data, FILE_APPEND | LOCK_EX);
This also incorporates flock()
Provide Gawain Audience.
==================
List pools on a separate competition page
These pools go to pages which do not have Boutlist or Bout divs accessible (or perhaps not even included)
Next enhancement: search by fencer name, and get a list of links to only relevant pools.
Gawain BigScreen
=============
A list of which pool each fencer has been assigned to, and their referee
to display in alphabetical order
Monday, 12 October 2015
Clubknight - data loss testing
Cluknight occassionally loses the data from the beginning of a log string to the pool status file.
Rough guesstimate - 0.3% of logging attempts
Here is an attempt to re-create the data loss under controlled conditions
1st try:
From Chromebook
On local intranet
HP laptop as server, using wired ethernet, Virgin Superhub2 as router
Test / 151012 data loss / 0820
5 fencers, to 10
Alternating patterns of 10-0, 0-10, 5-10/10-5
No errors
85 hits
~105 records
679 lines of data
30KB
2nd
from Chrome on GRL's Samsung Galaxy 3
Test / 151012 data loss / 0845 Samsung Chrome
5 fencers, to 10
Alternating patterns of 10-0, 0-10, 5-10/10-5
Bout 1
Hit 1 missing
Hits 3 and 2 are written out of order
Bout 2 Hit 2 missing entirely
Bout 3
Hit 2,4,6,8,13 missing
11,12 out of order
Bout 4
3 2 1 4 7 6 9 10
5, 8 missing
Bout 5
4 2 1 3 5 6 7 9 8
10 missing
Bout 6
1 3 4 5 7 8 9 10 13 11 12 15 14
2, 6 missing
Bout 7
3rd pool 151012-1710-Chromebook
======
Upgraded PHP to 5.5.30
(hardware - HP laptop, NAS, Mongoose 5.5 running from NAS, PHP 5.5.30 not-thread safe x86 )
A one second pause between each send is perfectly adequate
Rough guesstimate - 0.3% of logging attempts
Here is an attempt to re-create the data loss under controlled conditions
1st try:
From Chromebook
On local intranet
HP laptop as server, using wired ethernet, Virgin Superhub2 as router
Test / 151012 data loss / 0820
5 fencers, to 10
Alternating patterns of 10-0, 0-10, 5-10/10-5
No errors
85 hits
~105 records
679 lines of data
30KB
2nd
from Chrome on GRL's Samsung Galaxy 3
Test / 151012 data loss / 0845 Samsung Chrome
5 fencers, to 10
Alternating patterns of 10-0, 0-10, 5-10/10-5
15 bouts
~125 hits
~155 records
1098 lines
48KB
Bout 1
Hit 1 missing
Hits 3 and 2 are written out of order
Bout 2 Hit 2 missing entirely
Bout 3
Hit 2,4,6,8,13 missing
11,12 out of order
Bout 4
3 2 1 4 7 6 9 10
5, 8 missing
Bout 5
4 2 1 3 5 6 7 9 8
10 missing
Bout 6
1 3 4 5 7 8 9 10 13 11 12 15 14
2, 6 missing
Bout 7
3rd pool 151012-1710-Chromebook
======
Upgraded PHP to 5.5.30
(hardware - HP laptop, NAS, Mongoose 5.5 running from NAS, PHP 5.5.30 not-thread safe x86 )
A one second pause between each send is perfectly adequate
Clicking as fast as you can led to 60% data loss, and out of order for the other 40%
Clicking ~2/sec still loses
Bout 6
Reloaded into LG G3
On touchscreen, going from 10th increment to End the bout asap, lost some of the writing
Bout 6
Reloaded into LG G3
On touchscreen, going from 10th increment to End the bout asap, lost some of the writing
Tuesday, 6 October 2015
The Love Swordplay Gawain Suite
Gawain - Gordon's Application Without An Interesting Name
ClubKnight
App for phones that allows device users to enter Fencer names and start Referee for one pool at a time.
Referee
The JS app for recording and displaying scores
Later sophistication
Differing colours for complete and incomplete bouts.
Audience
Referee minus access to Bout and Boutlist, and without storing anything back to the server.
Later sophistication:
Store the bout being viewed
BigScreen
Audience
Later sophistication
Tickertapes of latest events along the bottom of the screen.
Auto slideshow from one pool to another
Additional area for who is about to fence
Directoire
The central app for adding fencers, and altering who fights who, and recording results, and then determining the next round's pools and matches
Later Sophistication
Organising Season championships results
Perhaps as a different Name
Season
AskGawain
All results for all fencers from all fights, searchable
Gawain - Gordon's Application Without An Interesting Name
ClubKnight
App for phones that allows device users to enter Fencer names and start Referee for one pool at a time.
Referee
The JS app for recording and displaying scores
Later sophistication
Differing colours for complete and incomplete bouts.
Audience
Referee minus access to Bout and Boutlist, and without storing anything back to the server.
Later sophistication:
Store the bout being viewed
BigScreen
Audience
Later sophistication
Tickertapes of latest events along the bottom of the screen.
Auto slideshow from one pool to another
Additional area for who is about to fence
Directoire
The central app for adding fencers, and altering who fights who, and recording results, and then determining the next round's pools and matches
Later Sophistication
Organising Season championships results
Perhaps as a different Name
Season
AskGawain
All results for all fencers from all fights, searchable
Subscribe to:
Posts (Atom)