From "Lessons Learned Optimizing NSQ"
- avoid []byte to string conversions
- re-use buffers or objects (use sync.Pool in Go 1.3)
- pre-allocate slices make([]byte, 0, 1024)
- explicitly specify number/size of items on the wire
- leave nothing unbounded
From "Lessons Learned Optimizing NSQ"
mindscratch: now that some people are here, here's an earlier question: hen performing a rolling update (https://github.com/GoogleCloudPlatform/kubernet...) ...how does kubernetes know which image to update if a pod has multiple containers with different images 2:23 PM
jbeda: mindscratch: Right now, it is run client side and is kind of a little too simple. 2:24 PM It captures the list of pods and just kills them one by one. It assumes there is a replication controller that will 'heal' them with the new version 2:24 PM
jbeda: Ideally, the 'upgrader' would make sure that the new pods come up okay, do some health checking, etc.
package main | |
import "testing" | |
import "time" | |
import "fmt" | |
func TestBar(t *testing.T) { | |
fmt.Println("FOO sleeping") | |
time.Sleep(time.Second) | |
fmt.Println("FOO done") |
TODOS:
JavaScriptMVC's controllers are many things. They are a jQuery plugin factory. They can be used as a traditional view, making pagination widgets and grid controls. Or, they can be used as a traditional controller, initializing and controllers and hooking them up to models. Mostly, controller's are a really great way of organizing your application's code.
Controllers provide a number of handy features such as:
%YAML 1.1 | |
--- | |
! "defaults": | |
! "cache": &7000 | |
! "username": "" | |
! "password": "" | |
! "servers": ["localhost:11211"] | |
! "development": | |
! "cache": *7000 | |
! "prod-server-a" |
# include version of rails | |
gem "rails", "3.0.9" | |
require "rails" | |
if Rails.env == 'development' | |
gem "my-other-project", "../my-other-project" | |
else | |
gem "my-other-project", "~> 0.0.1" | |
end |
module Mongoid | |
module Document | |
def as_json(options={}) | |
attrs = super options | |
attrs["id"] = attrs.delete "_id" if attrs.has_key? "_id" | |
attrs | |
end | |
end | |
end |
MyApp::Application.routes.draw do | |
my_draw = Proc.new do | |
get "widgets" => "widgets#index" | |
# add other routes here | |
end |
module ActionDispatch | |
module Routing | |
class Mapper | |
# resources can be one or more resource types (should be plural) | |
# | |
# ex: simple_resources :widgets | |
# | |
# This will generate the following routes: | |
# | |
# GET widgets => widgets#index |
# this file would live in myapp/confif directory | |
# this only shows the lines that I had uncommented/configured in the warble.rb file | |
# that was generated with warble v1.3.1 | |
Warbler::Config.new do |config| | |
config.dirs = %w(app config lib log vendor tmp) | |
config.webxml.jruby.compat.version = "1.9" |