1. 程式人生 > >Real Go Projects: SmartTwitter and web.go

Real Go Projects: SmartTwitter and web.go

19 October 2010

This week's article is written by Michael Hoisie. A programmer based in San Francisco, he is one of Go's early adopters and the author of several popular Go libraries. He describes his experiences using Go:

I was introduced to Go by a post on

Hacker News. About an hour later I was hooked. At the time I was working at a web start-up, and had been developing internal testing apps in Python. Go offered speed, better concurrency support, and sane Unicode handling, so I was keen to port my programs to the language. At that time there wasn't an easy way to write web apps in Go, so I decided to build a simple web framework,
web.go
. It was modeled after a popular Python framework, web.py, which I had worked with previously. While working on web.go I got involved in the Go community, submitted a bunch of bug reports, and hacked on some standard library packages (mainly http and json).

After a few weeks I noticed that web.go was getting attention at Github. This was surprising because I'd never really promoted the project. I think there's a niche for simple, fast web applications, and I think Go can fill it.

One weekend I decided to write a simple Facebook application: it would re-post your Twitter status updates to your Facebook profile. There is an official Twitter application to do this, but it re-posts everything, creating noise in your Facebook feed. My application allowed you to filter retweets, mentions, hashtags, replies, and more. This turned into Smart Twitter, which currently has nearly 90,000 users.

The entire program is written in Go, and uses Redis as its storage back-end. It is very fast and robust. It currently processes about two dozen tweets per second, and makes heavy use of Go's channels. It runs on a single Virtual Private Server instance with 2GB of RAM, which has no problem handling the load. Smart Twitter uses very little CPU time, and is almost entirely memory-bound as the entire database is kept in memory. At any given time there are around 10 goroutines running concurrently: one accepting HTTP connections, another reading from the Twitter Streaming API, a couple for error handling, and the rest either processing web requests or re-posting incoming tweets.

Smart Twitter also spawned other open-source Go projects: mustache.go, redis.go, and twitterstream.

I see a lot of work left to do on web.go. For instance, I'd like to add better support for streaming connections, websockets, route filters, better support in shared hosts, and improving the documentation. I recently left the start-up to do software freelancing, and I'm planning to use Go where possible. This means I'll probably use it as a back end for personal apps, as well as for clients that like working with cutting edge technology.

Finally, I'd like to thank the Go team for all their effort. Go is a wonderful platform and I think it has a bright future. I hope to see the language grow around the needs of the community. There's a lot of interesting stuff happening in the community, and I look forward to seeing what people can hack together with the language.

相關推薦

Real Go Projects: SmartTwitter and web.go

19 October 2010 This week's article is written by Michael Hoisie. A programmer based in San Francisco, he is

let's go, learn liunx and database today.

data 心情 裏的 申請 mil str tab log liunx 剛剛申請註冊博客記錄一下此時此刻的心情,哇.....太開心。今天開始學習的第一天吧,明天開始寫第一篇隨記,希望我在這裏的足跡伴我成長。加油.....let's go, learn l

不安分的 Go 語言開始入侵 Web 前端領域了

從 Go 語言誕生以來,它就開始不斷侵蝕 Java 、C、C++ 語言的領地。今年下半年 Go 語言釋出了 1.11 版本,引入了 WebAssembly 技術,瀏覽器端 Javascript 的壟斷地位也開始遭遇 Go 語言的攻擊。這次不同以往,它意味著 Go 語言從後端滲透進了前端,進入了一個全新的世界。

go語言渲染各種web格式的包render

Render是一個包,提供輕鬆呈現JSON,XML,文字,二進位制資料和HTML模板的功能。此包基於Martini 渲染工作。 渲染可以與幾乎任何Web框架一起使用,只要您可以http.ResponseWriter從處理程式訪問它。渲染函式只包含Go的現有功能,用於

Go語言實現簡單web應用cloudgo

cloudgo 框架選擇 Martini 功能列表 使用極其簡單. 無侵入式的設計. 很好的與其他的Go語言包協同使用. 超讚的路徑匹配和路由. 模組化的設計 - 容易插入功能件,也容易將其拔出來. 已有很多的中介軟體可以直接使用. 框架內已擁有很好的開箱即

go搭建一個簡單web伺服器

Go語言裡面提供了一個完善的net/http包,通過http包可以很 方便的就搭建起來一個可以執行的web服務。同時使用這個包能很簡單地對web的路由,靜態檔案,模版,cookie等數 據進行設定和操

Go語言:REST Web服務呼叫

Dynamsoft部署了基於REST的條形碼服務。這裡分享下如何使用Go語言傳送包含BASE64影象資料的HTTP POST請求。 環境配置 IDE: JetBrain Gogland.Go 1.7.4.Windows 10.工作目錄結構: <GOPATH>

go語言快速入門 Web開發框架 10

go語言進行開發Web開發,雖然使用go語言自身的包即可實現,但是需要快速開發的時候對初學者還是有一定的障礙。go語言有上千個開源的專案,而這其中也不乏面向web開發的框架,比如Revel/beego/iris等。 beego beego的開發者是中國的astaxie,是受了tornado 和

【Authentic Preference】Technologies come and technologies go, but insight is forever.

交流思想,注重分析,例項闡述,通俗易懂,包含但不限於:經典演算法,機器學習,深度學習,LeetCode 題解,Kaggle 實戰。期待您的到來! 演算法與人工智慧交流群:646901659

Go Slices: usage and internals

5 January 2011 Introduction Go's slice type provides a convenient and efficient means of working with sequences

Setup and config Go environment on Ubuntu 16.04 and Centos 7

Recently somebody have some questions for me. Why i can’t run go get ? How to change workspace project with Go ? Why after i exit session on terminal

Simple messaging framework using Go TCP server and Kafka GopherAcademy

I needed to create a simple framework to provide my endpoint devices ( doesn’t matter which platform they run on ) the

Face Detection in Go using OpenCV and MachineBox @ Alex Pliutau's Blog

I found a very nice developer-friendly project MachineBox, which provides some machine learning tools inside Docker Container, including fac

GoLand 2018.3 Beta: Change Signature refactoring, debugging Google App Engine, Testify, Go core dumps, and more

The upcoming GoLand 2018.3 release has reached the Beta milestone! If you’re new to our release cycles, we announce a Beta when we’ve packed e

Two Go Talks: "Lexical Scanning in Go" and "Cuddle: an App Engine Demo"

1 September 2011 On Tuesday night Rob Pike and Andrew Gerrand each presented at the Sydney Google Technology

[轉]Go語言(Golang)的Web框架比較:gin VS echo

所謂框架 框架一直是敏捷開發中的利器,能讓開發者很快的上手並做出應用,甚至有的時候,脫離了框架,一些開發者都不會寫程式了。成長總不會一蹴而就,從寫出程式獲取成就感,再到精通框架,快速構造應用,當這些方面都得心應手的時候,可以嘗試改造一些框架,或是自己創造一個。 曾經我以為Python世界裡的框架已經夠多了,後

不安分的 Go 語言開始入侵 Web 前端領域了!( WebAssembly )

fat 開發 zip input com pack 引擎 通過 就會 參考:https://blog.csdn.net/csdnnews/article/details/84038848 從 Go 語言誕生以來,它就開始不斷侵蝕 Java 、C、C++ 語言的領地。今年下半

首創詮釋docker的Formulas: Windows 7 + Tiny Linux 4.19 + XFS + Vmware Workstation = super machine (docker從零開始時記,Follow me and you go)

 不少人從來沒有接觸過docker,或者僅僅是聽說過,本文試圖從原點開始深入瞭解docker的全貌,剖析docker的基礎概念,讓我們一起開始docker之旅~~~ 開場:什麼是docker docker是一個容器平臺。 這是我最直接的定義,打字間我即興查了一下wiki,引證了以上單句

Java知識點歸納(J2EE and Web 部分)

angularjs 而且 要掌握 推薦 參數 wsdl 體系 發送 eem Web部分:   脫離開各種語言,純粹和 web相關的就是這些: HTML,CSS,JavaScript。哪怕你不用Java開發,用C#、PHP或者Python,這些內容都是通用,這裏主要偏重一些基

go語言學習之旅--Go 語言環境安裝

效率 安裝包 完成 內存 系統 開發 容易 tps 分布式系 前言 筆者已經自學python大概已經幾個月了,但是工作繁忙,而且工作中未用到python的知識。於是就漸漸生疏了,這是下定決心學習go,是因為公司有一臺go編寫的報表系統,而且公司逐漸在想docker轉,學習g