Skip to content

Instantly share code, notes, and snippets.

View palash25's full-sized avatar

Palash Nigam (He/Him) palash25

View GitHub Profile
@palash25
palash25 / alltutoroals.md
Created January 15, 2020 08:30 — forked from sdasgup3/alltutoroals.md
Few things I am inerested in!
@palash25
palash25 / benchmark+go+nginx.md
Created December 30, 2019 11:28 — forked from hgfischer/benchmark+go+nginx.md
Benchmarking Nginx with Go

Benchmarking Nginx with Go

There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.

So, these are the different settings we are going to compare:

  • Go HTTP standalone (as the control group)
  • Nginx proxy to Go HTTP
  • Nginx fastcgi to Go TCP FastCGI
  • Nginx fastcgi to Go Unix Socket FastCGI
palash25@Lenovo-G50  ~/Dev/Projects/wc   master ?  \time --format "\n real %E\t user %U\t sys %S\t mem %K\t ssize %p" wc ../../small-file-*
48414 81402 556859 ../../small-file-1
48414 81402 556859 ../../small-file-2
48414 81402 556859 ../../small-file-3
145242 244206 1670577 total
real 0:00.05 user 0.05 sys 0.00 mem 0 ssize 0
palash25@Lenovo-G50  ~/Dev/Projects/wc   master ?  \time --format "\n real %E\t user %U\t sys %S\t mem %K\t ssize %p" ./target/release/wc ../../small-file-*
48414 81402 556859 ../../small-file-1
48414 81402 556859 ../../small-file-2
@palash25
palash25 / dpkg-configure-log
Created September 29, 2019 06:41
Ran ` sudo update-rc.d mysql enable` before dpkg configure
palash25@Lenovo-G50  ~  sudo dpkg --configure -a  ✔  10131  12:06:01
Setting up mysql-server-5.7 (5.7.27-0ubuntu0.16.04.1) ...
Checking if update is needed.
Checking server version.
Running queries to upgrade MySQL server.
Checking system database.
mysql.columns_priv OK
mysql.db OK
mysql.engine_cost OK
mysql.event OK
node-01
cluster.name: test
node.name: es-master-01
node.master: true
node.ingest: false
node.data: true
http.enabled: false
path.data: data/master
discovery.zen.ping.unicast.hosts: ["localhost:9301", "localhost:9302"]
@palash25
palash25 / proto-club.pub
Created September 8, 2019 05:57
SSH key for proto-club (for the waitlist)
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC3CN8lWy1taT/QvOR/eWNfpU7jV9vHNggS4389ZnTq1CaBWW5Z/ysmzaepsmJ5sADeuTGWCb8Gt/oeva7mypvwLsMXxkt/oomqdUAcKd41UtJHSYSmn75YiEYDsIRxE4J7ahQf5/gKOeM5IMT4LxDeItLl9tNpHze63ea6WznxMrPCy6mDb1x7wO5ziRQCjNOkZBS3FtVMlPU6bph+gCYPbAWv/da/9NxenUS+slPWt6BofWEd6pN1XJjHmf7O5jtSbJYKUGClJ35gOpO4osdUcZwXCzUMmLok1EXXwkio0bEZjn5ftmjWLvUJMMsnffk8na+Hsk+hoEeBfw3I32ln palash25@Lenovo-G50
{
"_id" : "uhxZabiBml",
"class" : "Response",
"type" : "baseline_response",
"keys" : "answers,responseId,formId,isActive",
"formId" : "nNpqEjFEj8",
"_p_organization" : "Organization$Ftu5QdMygg",
"isActive" : true,
"useMasterKey" : true,
"queryString" : "\"formId\":\"nNpqEjFEj8\",\"answers.questionId\":\"V9gv0mHlen\",\"answers.text\":\"Mathura\"",
@palash25
palash25 / bulk_processor_example1.go
Created June 20, 2019 14:24 — forked from olivere/bulk_processor_example1.go
Example #1 of bulk processor usage
// This is an example of using elastic's BulkProcessor with Elasticsearch.
//
// See https://github.com/olivere/elastic and
// and https://github.com/olivere/elastic/wiki/BulkProcessor
// for more details.
/*
* This example illustrates a simple process that performs bulk processing
* with Elasticsearch using the BulkProcessor in elastic.
*
{
"_source": ["_id"],
"from": 1,
"size": 10,
"query": {
"bool": {
"filter": [{
"bool": {
"should": {
"bool": {
{
"organizationId": "atlan",
"order": "asc",
"allFormsFLag": true,
"formId": "hHhcLKh9st1vFr8nDY4a",
"dateField": "_created_at",
"startDate": "2019-05-20",
"endDate": "2019-05-21",
"userId": [
"gTOAbrbVUkPXgZYNXz2n"