Skip to content

A bot, which will randomly add or remove text in a mute collaboration session

Notifications You must be signed in to change notification settings

coast-team/mute-bot-random

Repository files navigation

Mute Bot Random Experiments

Description

This project provide tools to experiment CRDT performances, in a collaboration.

In order to simulate a collaboration, a bot has been developed. It plays randomly an insert or a deletion in a document, with a probability to move in this. (cf. mute-bot-random)


How to start an experiment

Requirements : you need to install docker before using this script

You can start an experiment with the start.sh script : ./start.sh ./path/docker-compose-file [number_of_experiment_simultaneous]

Or by using docker stack directly :

mkdir './Results/myName'
export BOTRANDOM_EXPERIMENT_NAME=myName
docker stack deploy -c 'compose_file' experiment_stack_name

Elements

The project is divided in four parts :

  • create-docker-compose : create a custom docker-compose file with your experiment's configuration
  • mute-bot-random : the bot source code
  • Results : some results done
  • results-exploit : tools in order to verify the snapshots integrity

create-docker-compose

The configuration of the experiment is in config.json. The JSON's structure is :

  • objective: the total number of operation targeted
  • delay: the time in ms before the bots will start the experiment
  • snapshot: the number of operation between two snapshots
  • bots : the list of bots
    • master : true if it's the master
    • botname : The name of the bot. Take attention to have a unique name in the experiment
    • time : the time between each operation
    • operation : the number of operation the bot will operate
    • deletion : the probability to have a delete operation in %
    • move : the probability to move in the document before an operation in %

Usage : node createDockerCompose.js. The docker-compose file generated is created and placed in the docker-compose folder with the name docker-compose-[timestamp].yml

mute-bot-random

You can build the project with npm run build

Usage: npm start -- [options]

Options:
  -V, --version                   output the version number
  -m, --master [url]              Master Url
  -p, --port [port]               The bot server port (default: 20001)
  -n, --namebot [name]            the name of the bot (default: "Bob")
  -o, --objective [nbOperations]  The number of operation (default: 10)
  --operation [nbOperations]      THe number of operation the bot will make (default: 10)
  --deletion [deletion]           The probability to have a deletion instead of an insertion (default: 0)
  --deplacement [deplacement]     The probability to move the cursor (default: 0)
  --time [ms]                     The time between each operations (default: 1000)
  --delay [ms]                    The time before starting (default: 5000)
  --address [adr]                 the adress of the node for exemple ws://[adr]:20001 (default: "localhost")
  -s, --snapshot [nbOperation]    save a snapshot of the structure every [nbOperation] operations (default: 10)
  -h, --help                      output usage information

Results

Results are save in a folder with timestamp as name. There is two kind of file :

  • Logs : all operation made and received by a node are in this file Logs.[botname].json
  • Snapshot : The serialized sequence crdt given with a certain number operations Snaphot.[nbOperation].[botname].json

result-exploit

You can build the project with npm run build

The first function is to compare str from snapshots in the ./input folder. You have to copy Snapshot file you want to compare in that folders, and only these. You can run npm run start

The second, is experiment on an other operation apply on a specific snapshot. This measure time to apply an operation on the structure. You can run npm start -- -e /snapshot/path