Informatics 117 : Team Optimize Prime
- Brenda La
- David Pham
- Eric Chou
- Jose Gomez
- Sheila Truong
$ go get -u github.com/govend/govend # make sure govend is installed
$ git clone https://github.com/blics18/SendGrid.git # grab all the code from github
$ govend -v # download all the dependencies in the vendor.yml file
healthBFcheck the status of the serverpopulateBFadd data into the Bloom FiltercheckBFcheck if data exists in the Bloom FilterclearBFclear the Bloom Filter
- healthBF
curl localhost:1234/healthBF - populateBF
curl localhost:1234/populateBF -d "[{\"UserID\": 123, \"Email\": [\"test@gmail.com\"]}]" - checkBF
curl localhost:1234/checkBF -d "{\"UserID\": 123, \"Email\": [\"test@gmail.com\"]}" - clearBF
curl localhost:1234/clearBF
BLOOM_SIZEsize of the Bloom FilterBLOOM_PORTport that the server will run onBLOOM_NUM_USERSnumber of users that will be generatedBLOOM_NUM_EMAILSup to this number of emails that each user will haveBLOOM_NUM_HASH_FUNCTIONSnumber of hash functionsBLOOM_NUM_TABLESis NOT configurable, because createTables.sql is hard coded to create only 5 tables.
-
client.go- Populate() - grabs data from MySQL, packages it as a JSON, and sends it to populateBF endpoint
- Clear() - calls clearBF endpoint to clear the bloom filter
- Check() - passes userid and list of emails to checkBF endpoint; calls checkBF to check if an input exists in the bloom filter
-
runClient.gothe client "main", and what we used to demo. Calls on all relevant endpoints (health, populate, check) -
server.go- healthBF() - checks to see if the server is up and running
- populateBF() - retreives the JSON data, parses it, and populates the bloom filter with it
- checkBF() - retreives the JSON data, parses it, and checks the data against the bloom filter. Also cross checks against the MySQL database if the data exists within the bloom filter
- clearBF() - clears the bloom filter
-
createTables.sqlSQL file that creates the database and tables -
database.gocreates and inserts randomly-generated data into the MySQL database -
server_test.gounit testing -
benchmark_test.gobenchmarking for each endpoint except healthBF -
generateEmail.gogenerates random userIDs and emails -
data.txtfile with randomly generated data (filled with suppression data and NON-suppresion data)
- Change into directory of
server_test.go - In the terminal, type
go test
- Change into directory of
benchmark_test.go - In the terminal, type
go test -run=XXX -bench=name_of_function()
- Make sure that Docker is downloaded and running
- Set up Graphite in docker:
docker run -d\
--name graphite\
--restart=always\
-p 80:80\
-p 2003-2004:2003-2004\
-p 2023-2024:2023-2024\
-p 8125:8125/udp\
-p 8126:8126\
hopsoft/graphite-statsd
- Run server.go, and test using curl commands
- Go to
localhostin any browser to check and configure the metrics
- Create the docker container:
docker run -v $(pwd)/createTables.sql:/root/createTables.sql --name bfmysql -it -d -e MYSQL_ALLOW_EMPTY_PASSWORD=1 -p 3306:3306 percona - Run this command on the container:
docker exec -it bfmysql /bin/bash - Change directories to where the .sql file is stored:
cd /root - Run the file that creates the schema with
mysql < createTables.sql
- Hits: Number of ACCURATE predictions. This has nothing to do if the value is in the Bloom Filter or not.
- Misses: Number of INACCURATE predictions. This has nothing to do if the value is in the Bloom Filter or not.