Skip to content

Instantly share code, notes, and snippets.

View preetapan's full-sized avatar

Preetha preetapan

View GitHub Profile
// benchmarking hello.go
package main
import "testing"
func BenchmarkIOload(b *testing.B) {
for n := 0; n < b.N; n++ {
IOload()
}
}
@preetapan
preetapan / hello.go
Last active July 6, 2020 16:35
signal benchmarking
// attempt at benchmarking the claim in https://twitter.com/felixge/status/1278422338648838146
package main
import "fmt"
import "net/http"
import "io/ioutil"
import "os"
import "os/signal"
import "syscall"
import "time"

Notes from testing hashiconf digital demo setup with Chris Piraino

Ran fake service in k8s, it has web/api/cache and db as subcomponents.

Ran k8s get pods to show the different components

Created first mesh gateways via systcl job

Spun up secondary dc, used k8s setup mechanism to get federation secret

Understanding system job reconcilation

Case Current Behavior Desired Behavior
New Job Placed on all eligiblie nodes, queued allocs for nodes that don't have capacity
Node update
Job updated to have constraints
Job updated (any other update)
Node added with existing system jobs running on ineligible nodes
Node updated to match system job's constraint
@preetapan
preetapan / conn_limit.go
Created January 27, 2020 23:40
Connection limit tester
package main
import (
"log"
"net"
"fmt"
)
func main() {
for i:=0; i< 101; i++ {
go testConn(i)
preetha@preetha-work ~/go/src/github.com/hashicorp/consul-template (master) $make test
==> Testing consul-template
[server.go:353: failed http getGet http://127.0.0.1:34910/v1/catalog/nodes?index=0: dial tcp 127.0.0.1:34910: getsockopt: connection refused
]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x4fa9d5]
goroutine 1 [running]:
testing.(*T).Log(0x0, 0xc4201be8c0, 0x1, 0x1)
<autogenerated>:1 +0x5

Keybase proof

I hereby claim:

  • I am preetapan on github.
  • I am preethaa (https://keybase.io/preethaa) on keybase.
  • I have a public key ASCc_bexVUd2pRZ5M9NjS0ddfFRFG9qn1gvNSK0ZeFHAWAo

To claim this, I am signing this object:

@preetapan
preetapan / watches.txt
Last active June 22, 2017 22:13
testing consul watches
//agent config file with watch handler
{
"advertise_addr": "127.0.0.1",
"bind_addr": "127.0.0.1",
"data_dir":"/tmp/consultest",
"datacenter":"mydc",
"ui":true,
"server":true,
"watches":[
{
@preetapan
preetapan / configs.json
Created June 19, 2017 20:56
test server/acl configs
//contents of consul agent json config
{
"ports": {
"dns": 0,
"https": -1,
"serf_lan": 8301,
"serf_wan": 8302,
"server": 8300
},
@preetapan
preetapan / acl_test.sh
Created June 19, 2017 20:48
testing master acl
curl -X PUT --data @service_payload.json http://localhost:8500/v1/catalog?token=ACL_MASTER_TOKEN
curl http://localhost:8500/v1/catalog/services?token=ACL_MASTER_TOKEN
curl -X PUT --data @deregister_payload.json http://localhost:8500/v1/catalog/deregister?token=ACL_MASTER_TOKEN