Skip to content

Instantly share code, notes, and snippets.

@jeanqasaur
jeanqasaur / mgritter_profile2.prof
Created September 21, 2021 17:31
Diffing before and after Go increases heap size
Showing nodes accounting for 419.70MB, 87.98% of 477.03MB total
Dropped 129 nodes (cum <= 2.39MB)
Showing top 10 nodes out of 114
flat flat% sum% cum cum%
231.14MB 48.45% 48.45% 234.14MB 49.08% io.ReadAll
52.93MB 11.10% 59.55% 53.43MB 11.20% github.com/google/gopacket/pcap.(*Handle).ReadPacketData
51.45MB 10.79% 70.33% 123.88MB 25.97% github.com/google/gopacket.(*PacketSource).NextPacket
42.42MB 8.89% 79.23% 42.42MB 8.89% bytes.makeSlice
@jeanqasaur
jeanqasaur / mgritter_profile1.prof
Last active September 21, 2021 17:20
Profiles before and after using a preallocated stack
// before
flat flat% sum% cum cum%
7562.56MB 27.14% 27.14% 7562.56MB 27.14% github.com/akitasoftware/akita-libs/visitors/http_rest.stackVisitorContext.appendPath
// after
flat flat% sum% cum cum%
1225.56MB 5.99% 23.87% 2439.59MB 11.93% github.com/akitasoftware/akita-libs/visitors/http_rest.stackVisitorContext.EnterStruct
892.03MB 4.36% 33.36% 892.03MB 4.36% github.com/akitasoftware/akita-libs/visitors/http_rest.stackVisitorContext.appendPath
@jeanqasaur
jeanqasaur / mgritter_profile0.prof
Created September 21, 2021 16:56
Go heap profiler dump
Showing nodes accounting for 70.08GB, 72.68% of 96.42GB total
Dropped 404 nodes (cum <= 0.48GB)
Showing top 10 nodes out of 154
flat flat% sum% cum cum%
36.60GB 37.96% 37.96% 36.60GB 37.96% github.com/akitasoftware/akita-libs/visitors/http_rest.(*specVisitorContext).appendPath
5.38GB 5.58% 43.54% 5.38GB 5.58% reflect.packEface
5.24GB 5.44% 48.97% 5.24GB 5.44% bytes.makeSlice
4.60GB 4.77% 53.74% 4.60GB 4.77% time.parse
4.25GB 4.41% 58.15% 4.25GB 4.41% encoding/json.(*Decoder).refill
3.67GB 3.81% 61.96% 3.68GB 3.82% github.com/google/gopacket/pcap.(*Handle).ReadPacketData
@jeanqasaur
jeanqasaur / akita_capture_daemonset_snippet.yaml
Created July 13, 2021 21:42
Akita CLI Daemonset for production use (snippet)
env:
- name: AKITA_DEPLOYMENT
value: production
@jeanqasaur
jeanqasaur / delete_todo.sh
Created May 17, 2021 23:04
CURL request for deleting a TODO
curl --location --request DELETE 'localhost:30123/todos/8376e9a5-e113-4bb9-9432-7237c2133d2b'
@jeanqasaur
jeanqasaur / update-to-service.yaml
Last active May 17, 2021 23:44
Updates to service.yaml
- name: akita
image: akitasoftware/cli:latest
lifecycle:
preStop:
exec:
command:
- "/bin/sh"
- "-c"
- "AKITA_PID=$(pgrep akita) && kill -2 $AKITA_PID && tail -f /proc/$AKITA_PID/fd/1"
env:
@jeanqasaur
jeanqasaur / api-secrets.yaml
Created May 17, 2021 23:00
API secrets file
apiVersion: v1
kind: Secret
metadata:
name: akita-secrets
type: Opaque
data:
api-key-id: # REPLACE WITH YOUR API KEY ID BASE 64 ENCODED
api-key-secret: # REPLACE WITH YOUR API KEY SECRET BASE 64 ENCODED
@jeanqasaur
jeanqasaur / curl_to_create_item.sh
Created May 17, 2021 22:59
CURL request for adding to TODOs
curl --location --request POST 'localhost:30123/todos' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Write an API Spec for this",
"description": "API specs are nice but they are a pain to write..."
}'
@jeanqasaur
jeanqasaur / list_todos_curl.sh
Created May 17, 2021 22:57
List TODOs via CURL
curl --location --request GET 'localhost:30123/todos' 
@jeanqasaur
jeanqasaur / sample_response.json
Created May 17, 2021 22:55
Sample JSON response
{
"todos": []
}