Giter Club home page Giter Club logo

gcp-infra-stuff's Introduction

gcp-infra-stuff

Getting the Goodies

Pre-requisite for running the scripts

  • install few updates and stuff..
sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get install git -y 
pip install --user --upgrade google-api-python-client 

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
sudo python get-pip.py

  • get the files using this command:
git clone https://github.com/amiteinav/image-processing.git

Preemptible VMs

Making sure to have enough preemptible VMs on your Managed Instance Group

Google Cloud's Preemptible VMs are awesome - if you have a stateless workload, you should definitely try these out.

There are two scripts to use - pvm/calc_ig.py and pvm/monitor_ig.bash

The logic is to check every 60 seconds if a managed instances group of Preemptible VMs is as big as it should be and enlarging it based on the ratio of the lacking.

Once the group is too big, it is bringing it back to the regular size. So if you have 60 pre-emptible VMs out of 90 pre-emptible, the script will add 45 more (1/(60/90)x90).

In GCP we implement that using a startup script on a small server that runs in an instance group in three separate regions that should suffice for 100% availability 

Counting lines in python - count_lines.py

In the file count_lines.py there are Functions to count lines

bufcount took 5401.664 ms for 35M rows whilw simplecount took 3287.357 ms for 35M rows

targetting a 35M rows and getting a specific line took 15560.325 ms with this command:

print linecache.getline(filename, line_no)

the file create_lines.bash is a super-simple bash script that i used to create non-random lines

gcp-infra-stuff's People

Contributors

amiteinav avatar

Watchers

James Cloos avatar  avatar

Forkers

blockspacer

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.