Which is the fastest web framework?

For a project I was reading some benchmarks at GitHub and google, I found an article then I was surprised, its too much interesting result for me, you can check the result below.

Results

LanguageFrameworkAverage50th percentile90th percentileStandard deviationRequests / sThroughput
rust (1.38)nickel (0.11)0.24 ms0.20 ms0.39 ms199.3337636.674.97 Mb
ruby (2.6)syro (3.1)2.70 ms0.63 ms7.94 ms4143.6746844.331.80 Mb
ruby (2.6)roda (3.25)2.79 ms0.67 ms8.10 ms4188.6745494.672.88 Mb
rust (1.38)iron (0.6)3.04 ms2.93 ms4.49 ms1368.6721289.671.76 Mb
ruby (2.6)cuba (3.9)3.06 ms0.57 ms9.41 ms5064.3341756.673.27 Mb
ruby (2.6)rack-routing (0.0)3.84 ms0.73 ms11.38 ms5596.0033197.001.27 Mb
c (11)agoo-c (0.7)4.59 ms4.28 ms8.86 ms3377.00209196.008.02 Mb
ruby (2.6)camping (2.1)4.67 ms0.49 ms16.08 ms8578.6727517.671.74 Mb
node (12.11)sifrr (0.0)4.79 ms4.32 ms9.82 ms4054.33203003.6711.84 Mb
nim (1.0)httpbeast (0.2)5.02 ms4.54 ms9.61 ms3651.00192873.3318.20 Mb
python (3.7)japronto (0.1)5.13 ms4.63 ms9.96 ms3909.00189149.6715.00 Mb
cpp (11)drogon (1.0)5.42 ms4.90 ms9.91 ms3546.00177889.3311.44 Mb
ruby (2.6)flame (4.18)5.47 ms0.49 ms19.16 ms10784.3323469.670.90 Mb
swift (5.1)swifter (1.4)5.56 ms0.85 ms14.54 ms86445.0011871.001.01 Mb
cpp (11)evhtp (1.2)5.90 ms5.24 ms9.56 ms2929.33160195.6710.30 Mb
go (1.13)gorouter-fasthttp (4.2)6.04 ms5.38 ms9.31 ms3625.67156380.0016.64 Mb
go (1.13)fasthttprouter (0.1)6.18 ms5.11 ms9.14 ms9601.00161432.0017.23 Mb
go (1.13)atreugo (8.2)6.26 ms5.19 ms9.27 ms8758.00159818.3321.31 Mb
go (1.13)fasthttp (1.5)6.33 ms4.87 ms8.99 ms12920.33168733.3318.05 Mb
crystal (0.31)router.cr (0.2)6.46 ms5.66 ms10.55 ms3220.00149292.339.31 Mb
crystal (0.31)toro (0.4)6.47 ms5.67 ms10.55 ms3222.00148845.339.28 Mb
ruby (2.6)hanami (1.3)6.66 ms0.60 ms22.99 ms11912.3319246.009.67 Mb
crystal (0.31)raze (0.3)6.75 ms5.91 ms10.91 ms3312.00143044.338.91 Mb
java (8)rapidoid (5.5)6.80 ms5.09 ms11.01 ms13146.00163718.0019.53 Mb
crystal (0.31)kemal (0.28)7.09 ms6.44 ms10.91 ms3221.67135783.6714.71 Mb
nim (1.0)jester (0.4)7.29 ms6.65 ms11.72 ms3980.00145089.0019.33 Mb
c (11)kore (3.3)7.41 ms5.96 ms13.15 ms9455.67161905.6729.17 Mb
crystal (0.31)amber (0.3)7.67 ms7.04 ms12.12 ms3559.67126369.6715.33 Mb
ruby (2.6)sinatra (2.0)7.97 ms0.68 ms26.40 ms13397.6716038.672.76 Mb
crystal (0.31)orion (1.7)8.35 ms7.80 ms13.19 ms3888.33116803.0012.65 Mb
ruby (2.6)grape (1.2)9.51 ms0.80 ms31.25 ms15583.6713576.000.51 Mb
java (8)act (1.8)9.73 ms7.65 ms13.12 ms15954.67121682.3313.92 Mb
go (1.13)gorouter (4.2)9.88 ms8.05 ms16.18 ms9871.67105554.679.31 Mb
go (1.13)rte (0.0)9.89 ms7.84 ms15.73 ms13656.33107851.679.58 Mb
rust (1.38)actix-web (1.0)10.23 ms9.78 ms13.79 ms3258.67105115.3310.09 Mb
go (1.13)echo (4.1)10.69 ms8.56 ms19.02 ms8175.6796770.6711.26 Mb
go (1.13)violetear (7.0)10.72 ms8.90 ms16.17 ms12167.0097186.008.55 Mb
go (1.13)gin (1.4)10.99 ms8.60 ms19.20 ms10553.0096706.3311.25 Mb
go (1.13)goroute (0.0)11.04 ms8.56 ms19.05 ms13101.0096836.0011.27 Mb
go (1.13)chi (4.0)11.16 ms8.27 ms18.36 ms17216.00101013.678.96 Mb
go (1.13)beego (1.12)11.22 ms8.77 ms19.63 ms10964.0095757.678.54 Mb
go (1.13)kami (2.2)11.31 ms8.63 ms17.37 ms18533.0098168.678.66 Mb
go (1.13)webgo (3.0)11.62 ms9.32 ms18.84 ms12303.3391533.008.08 Mb
python (3.7)falcon (2.0)12.45 ms10.15 ms20.53 ms7317.6780978.0012.58 Mb
go (1.13)air (0.13)12.70 ms9.58 ms23.38 ms12702.0084610.0011.70 Mb
swift (5.1)perfect (3.1)12.99 ms13.07 ms15.50 ms4827.3374517.004.64 Mb
go (1.13)gorilla-mux (1.7)13.51 ms8.56 ms19.96 ms33361.3395175.678.43 Mb
csharp (7.3)aspnetcore (2.2)13.52 ms9.69 ms16.21 ms33059.3387579.339.45 Mb
node (12.11)polkadot (1.0)13.54 ms9.24 ms17.63 ms33076.3393298.679.27 Mb
go (1.13)gf (1.9)13.58 ms10.90 ms23.38 ms11764.6777603.008.73 Mb
php (7.3)one (1.8)13.74 ms12.47 ms23.63 ms8067.6773012.0011.12 Mb
ruby (2.6)agoo (2.11)13.96 ms13.56 ms18.36 ms3473.6770218.332.69 Mb
node (12.11)0http (1.2)15.87 ms9.40 ms17.70 ms45955.3391692.009.11 Mb
php (7.3)hyperf (1.0)16.97 ms14.55 ms32.28 ms11795.3361592.338.70 Mb
rust (1.38)gotham (0.4)17.32 ms16.37 ms24.25 ms18398.0059471.008.00 Mb
node (12.11)rayo (1.3)17.50 ms10.49 ms20.18 ms48826.3380132.337.96 Mb
node (12.11)polka (0.5)17.51 ms10.14 ms19.82 ms50286.6782259.338.17 Mb
ruby (2.6)plezi (0.16)17.71 ms16.45 ms23.31 ms8987.6755487.337.84 Mb
python (3.7)bottle (0.12)18.49 ms15.86 ms30.21 ms10116.6754975.338.98 Mb
php (7.3)sw-fw-less (preview)19.53 ms17.97 ms31.21 ms9924.0050967.007.76 Mb
python (3.7)blacksheep (0.2)19.53 ms17.34 ms32.78 ms10283.3351572.676.88 Mb
kotlin (1.3)ktor (1.2)19.86 ms12.19 ms29.10 ms52312.6772213.007.46 Mb
python (3.7)asgineer (0.7)20.12 ms17.88 ms33.06 ms10311.6749954.005.91 Mb
node (12.11)restana (3.3)20.18 ms9.67 ms19.11 ms67392.0088524.008.79 Mb
node (12.11)muneem (2.4)21.71 ms11.72 ms22.32 ms65248.0072124.007.16 Mb
python (3.7)hug (2.6)21.91 ms17.88 ms35.48 ms13931.6746597.007.66 Mb
python (3.7)starlette (0.12)22.08 ms18.90 ms37.56 ms11508.3345531.336.50 Mb
node (12.11)foxify (0.1)22.35 ms12.59 ms23.78 ms62906.6768189.009.50 Mb
clojure (1.10)coast (1.0)22.53 ms19.66 ms21.77 ms36208.0048332.005.76 Mb
php (7.3)swoft (2.0)23.21 ms22.53 ms30.76 ms6650.3341957.677.31 Mb
node (12.11)iotjs-express (0.0)24.19 ms14.39 ms26.72 ms64464.6759753.6716.09 Mb
swift (5.1)kitura-nio (2.8)25.57 ms20.16 ms23.38 ms61899.0047177.005.82 Mb
php (7.3)imi (1.0)26.63 ms25.65 ms33.72 ms6709.6736652.005.58 Mb
swift (5.1)kitura (2.8)27.10 ms20.72 ms23.75 ms66177.6746502.675.73 Mb
node (12.11)restify (8.4)28.43 ms19.08 ms31.25 ms59532.0045832.335.33 Mb
node (12.11)koa (2.8)28.76 ms13.84 ms26.71 ms85051.0060916.338.55 Mb
node (12.11)express (4.17)29.69 ms15.76 ms29.73 ms82691.3353886.008.75 Mb
java (8)spring-boot (2.1)29.70 ms16.10 ms36.25 ms86239.6747422.332.52 Mb
node (12.11)fastify (2.8)32.84 ms15.00 ms27.96 ms105969.0060039.3310.56 Mb
ruby (2.6)rails (6.0)33.29 ms2.49 ms110.27 ms63071.673850.331.61 Mb
python (3.7)fastapi (0.42)36.39 ms32.15 ms60.51 ms19152.0027792.003.98 Mb
python (3.7)responder (2.0)36.72 ms34.41 ms58.42 ms16339.3327054.333.91 Mb
crystal (0.31)spider-gazelle (1.6)37.63 ms35.73 ms45.36 ms15535.3326014.671.84 Mb
python (3.7)clastic (19.9)40.15 ms33.18 ms65.65 ms19619.0024875.674.09 Mb
python (3.7)molten (0.27)40.30 ms33.85 ms66.82 ms19592.0025365.673.13 Mb
fsharp (7.3)suave (2.5)40.58 ms24.44 ms100.56 ms50407.6724596.333.30 Mb
python (3.7)flask (1.1)41.74 ms36.29 ms63.43 ms16853.6723598.003.85 Mb
crystal (0.31)lucky (0.18)42.86 ms40.21 ms52.32 ms14370.3322844.331.87 Mb
node (12.11)turbo_polka (2.0)44.09 ms42.05 ms48.93 ms22248.3322322.001.39 Mb
python (3.7)aiohttp (3.6)44.17 ms42.06 ms69.09 ms19059.3322607.003.40 Mb
python (3.7)bocadillo (0.18)52.16 ms45.99 ms87.88 ms30216.0019473.672.50 Mb
java (8)micronaut (1.2)52.78 ms23.20 ms97.08 ms128239.6724704.673.43 Mb
swift (5.1)vapor (3.3)53.36 ms17.34 ms32.92 ms219012.3348897.335.54 Mb
php (7.3)lumen (6.2)53.83 ms18.27 ms114.41 ms112798.6743774.3314.42 Mb
php (7.3)slim (4.3)54.73 ms18.51 ms112.98 ms117455.3343835.0014.43 Mb
php (7.3)zend-expressive (3.2)55.56 ms18.58 ms123.67 ms115767.3343418.3314.30 Mb
python (3.7)sanic (19.9)57.11 ms51.21 ms96.65 ms38019.0018091.002.14 Mb
php (7.3)basicphp (0.9)58.93 ms19.67 ms119.40 ms123055.3340573.0013.40 Mb
php (7.3)spiral (2.2)59.60 ms59.64 ms66.25 ms8035.6716327.331.88 Mb
php (7.3)symfony (4.3)59.85 ms19.16 ms119.08 ms133181.3340957.3313.49 Mb
php (7.3)zend-framework (3.1)59.94 ms19.09 ms127.72 ms129446.6741951.3313.82 Mb
scala (2.12)http4s (0.18)65.22 ms19.31 ms45.01 ms257133.6745286.005.27 Mb
node (12.11)hapi (18.4)66.34 ms24.26 ms46.49 ms204446.6735301.336.07 Mb
crystal (0.31)athena (0.7)67.28 ms48.80 ms180.47 ms84270.6724144.672.01 Mb
php (7.3)laravel (6.4)81.27 ms22.88 ms171.46 ms188420.3335942.3311.89 Mb
node (12.11)moleculer (0.13)85.99 ms27.18 ms60.05 ms254224.6730295.333.46 Mb
python (3.7)quart (0.10)88.90 ms75.34 ms156.00 ms46756.3311209.001.48 Mb
python (3.7)cherrypy (18.3)89.78 ms73.66 ms79.81 ms233050.001373.670.21 Mb
go (1.13)gramework (1.6)96.01 ms97.62 ms102.01 ms18890.3310148.001.72 Mb
python (3.7)tornado (5.1)101.51 ms100.19 ms126.70 ms34740.679525.331.87 Mb
python (3.7)django (2.2)105.60 ms93.93 ms163.05 ms36832.339189.331.77 Mb
java (8)javalin (3.5)125.41 ms11.66 ms290.35 ms362928.3356370.676.67 Mb
python (3.7)masonite (2.2)138.54 ms129.50 ms179.52 ms53997.676988.671.14 Mb
perl (5.3)dancer2 (2.0)162.32 ms58.98 ms364.69 ms338036.671492.000.22 Mb
crystal (0.31)onyx (0.5)193.90 ms193.25 ms226.42 ms28283.675066.000.87 Mb
scala (2.12)akkahttp (10.1)220.51 ms7.35 ms96.23 ms873321.6765406.009.38 Mb
python (3.7)cyclone (1.3)399.23 ms351.41 ms445.11 ms460804.672202.670.37 Mb
python (3.7)nameko (2.12)655.34 ms551.15 ms613.68 ms770037.671278.000.18 Mb

You can find original page https://github.com/the-benchmarker/web-frameworks#results

How to get data from Twitch-API with python

Hello Everyone,

This is a small quick py script for how to call API and how to parse json to csv with pandas for the beginners.

1 – Install below libraries,

import pandas as pd
import requests
import json

2 – Set your static values, btw you can use those values with .yml file

url = “https://wind-bow.glitch.me/twitch-api/channels/”
# List of channels we want to access
channels = [“ESL_SC2”, “OgamingSC2”, “cretetion”, “freecodecamp”, “storbeck”, “habathcx”, “RobotCaleb”, “noobs2ninjas”,
“ninja”, “shroud”, “Dakotaz”, “esltv_cs”, “pokimane”, “tsm_bjergsen”, “boxbox”, “a_seagull”,
“kinggothalion”, “jahrein”, “thenadeshot”, “sivhd”, “kingrichard”]

file_name = “talih.csv”
location =”C:\\Users\\talih\\Desktop\\TwitchPy\\TwitchAPI\\”
“”” Those values can be used with .yml file “””

3 – Set your class,functions:
class apicrawler:

def __init__(self,url,channels,file_name,location):
self.url = url
self.channels = channels
self.file_name = file_name
self.location = location

def selectedchannelcrawler(url,channels,location,file_name):
channels_list = []
for channel in channels:
JSONContent = requests.get(url + channel).json()
channels_list.append([JSONContent[‘_id’], JSONContent[‘display_name’], JSONContent[‘status’],
JSONContent[‘followers’], JSONContent[‘views’]])

dataset = pd.DataFrame(channels_list)
dataset.columns = [‘Id’, ‘Name’, ‘Status’, ‘Followers’, ‘Views’]
dataset.dropna(axis = 0, how = ‘any’, inplace = True)
dataset.index = pd.RangeIndex(len(dataset.index))
dataset.to_csv(location + file_name, sep=’,’, encoding=’utf-8′)

4 – Call that class for your own values:
apicrawler.selectedchannelcrawler(url,channels,location,file_name)

Enjoy

How to append your data from Cloud Storage to BigQuery with Python (ETL)

Hello Everyone,

BigQuery is a fully-managed enterprise data warehouse for analytics. It is cheap and high-scalable. In this article, I would like to share a basic tutorial for Google Cloud Storage and  BigQuery with Python.

Installation
pip install google-cloud-bigquery

Create credentials

export GOOGLE_APPLICATION_CREDENTIALS="/home/user/Downloads/[FILE_NAME].json

Additionally, please set the PATH to environment variables.

Read from Cloud Storage Append on Big Query

#Import libraries
from google.cloud import bigquery
from google.oauth2 import service_account

#Set Credentials “Create your own credential files on google cloud account”
credentials = service_account.Credentials.from_service_account_file(
‘C:\\Users\\talih\Desktop\\BigQuerytoTableau-6d00b31bb9ab.json’)
project_id = ‘bigquery-to-tableau’

#Set table_ref,project_id and credentials for POST request
client = bigquery.Client(credentials= credentials,project=project_id)
table_ref = client.dataset(‘BigTableau’).table(‘dataflowbasics_schemas’)

#Specify your api post requests with  a few parameter
job_config = bigquery.LoadJobConfig()
job_config.write_disposition = bigquery.WriteDisposition.WRITE_EMPTY
job_config.skip_leading_rows = 1
job_config.autodetect = True
job_config.allow_jagged_rows = True
job_config.ignore_unknown_values = True
job_config.max_bad_records = 1000
schema = [
bigquery.SchemaField(‘bietl_id’, ‘INTEGER’, mode=’REQUIRED’),
bigquery.SchemaField(‘bietltools_name’, ‘STRING’, mode=’REQUIRED’),
bigquery.SchemaField(‘bietl_usage’, ‘FLOAT’, mode=’NULLABLE’),
bigquery.SchemaField(‘bietl_salary’, ‘INTEGER’, mode=’NULLABLE’),
]
job_config.schema = schema

#Set your cloud storage bucket name
uri = ‘gs://desctinations3tostorage/bietl20180829.csv’

#Post your request to Google Api
load_job = client.load_table_from_uri(
uri,
table_ref,
job_config=job_config) # API request

assert load_job.job_type == ‘load’

load_job.result() # Waits for table load to complete.

assert load_job.state == ‘DONE’

Now you can access your own data on big query interfaces.

How to use dbt in python environment

Dbt is usefull library for dwh to create a datamart or datamarts. You can find all details in dbt official pages.

I used a few times, so i can clarify for you how you can create a dbt models and dbt configs in your own project, you can do that like below step by steps;

1 – Create a profiles.yml file for DBT Profile. Specify your db connection information etc.
2 – Create a data_model folder like project_dir
3 – Create a .yml file for main project .yml file and you will call it like project_file
4 – Create your own dbt_runner file like dbt_runner.py and set it your execution configs
5 – Create a model folder, you will put your models in that folder
6 – Create a schema or model for yourself and put into that folder a xxxx.schema.yml file
6.1 – Put some table value like below;
bietl_patch:
constraints:
unique:
– somthng_id
not_null:
– somthng_id
– xxx_id

In the end, you will have like below folder and schema;
# DBT Profile. Specify your DB connection information etc.
profiles.yml on the root directory
bietl_data_model folder
bietl_datamarts.yml file
dbt_runner.py python file

bietl_data_model
> models
> specification of your models bietl
> bietl_datamarts.schema.yml
> sql files for using.sql

I’m executing that dbt in airflow das but I didn’t mention it, maybe in next post.