Posts

Showing posts with the label Systems

groovy scripts for Jenkins

At some point, if you are working on managing  Jenkins  for your team, you will find yourself looking for a set of useful groovy scripts to control jenkins configuration for a large no of builds/jobs. Following are some mostly frequently needed ones Get all jobs that belong to a view  hudson.model.Hudson.instance.getView('my-view')?.items.each() { println it.fullDisplayName } Clear the build queue   import hudson.model.* def queue = Hudson.instance.queue println "Queue contains ${queue.items.length} items" queue.clear() println "Queue cleared" Disable jobs in a view  hudson.model.Hudson.instance.getView('1.1.x-tests')?.items.each() { println("JOB : "+it.name) it.disabled=true it.save() } Get all jobs that that define a TimerTrigger with the trigger spec  import hudson.model.* import hudson.triggers.* for(item in Hudson.instance.items) { for(trigger in item.triggers.values()) { if(trig...

unique id generation at high scale

Moving away from relational db allows us to work with huge data, which would otherwise be not feasible. But, it also mandates us to look into the issues that we didn't have to consider much about. One of such thing was generating unique ids. With mysql you get auto-incremented ids which work absolutely fine for most of the use cases. But, for other systems, in context of nosql/distributed systems, that job is on system designer's shoulder. Inherently one-size fits all solution is difficult to come with. There are many solutions proposed for this ubiquitous problem. Twitter has developed  snowflake  which solves it.  They guarantee id generation with the following constraints : minimum 10k ids per second per process response rate 2ms (plus network latency The other solution I found is   flake   by boundary . It achieves the goal of generating ids with good performance and adequate bit size 128 which snowflake lacked. I will update more inform...