《Mastering Concurrency in Go》

《Mastering Concurrency in Go》 《Mastering Concurrency in Go》

  • 书名:《Mastering Concurrency in Go》
  • 分类:计算机
  • 作者:Nathan Kozyra
  • 出版社:Packt Publishing - ebooks Account
  • 出版年:2014-7-25
  • 售价:USD 50.99
  • 装订:Paperback
  • 页码:301

《Mastering Concurrency in Go》 目录大纲:

Table of Contents
Mastering Concurrency in Go
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. An Introduction to Concurrency in Go
Introducing goroutines
A patient goroutine
Implementing the defer control mechanism
Using Go's scheduler
Using system variables
Understanding goroutines versus coroutines
Implementing channels
Channel-based sorting at the letter capitalization factory
Cleaning up our goroutines
Buffered or unbuffered channels
Using the select statement
Closures and goroutines
Building a web spider using goroutines and channels
Summary
2. Understanding the Concurrency Model
Understanding the working of goroutines
Synchronous versus asynchronous goroutines
Designing the web server plan
Visualizing concurrency
RSS in action
An RSS reader with self diagnostics
Imposing a timeout
A little bit about CSP
The dining philosophers problem
Go and the actor model
Object orientation
Demonstrating simple polymorphism in Go
Using concurrency
Managing threads
Using sync and mutexes to lock data
Summary
3. Developing a Concurrent Strategy
Applying efficiency in complex concurrency
Identifying race conditions with race detection
Using mutual exclusions
Exploring timeouts
Importance of consistency
Synchronizing our concurrent operations
The project – multiuser appointment calendar
Visualizing a concurrent pattern
Developing our server requirements
Web server
The Gorilla toolkit
Using templates
Time
Endpoints
Custom structs
A multiuser Appointments Calendar
A note on style
A note on immutability
Summary
4. Data Integrity in an Application
Getting deeper with mutexes and sync
The cost of goroutines
Working with files
Getting low – implementing C
Touching memory in cgo
The structure of cgo
The other way around
Getting even lower – assembly in Go
Distributed Go
Some common consistency models
Distributed shared memory
First-in-first-out – PRAM
Looking at the master-slave model
The producer-consumer problem
Looking at the leader-follower model
Atomic consistency / mutual exclusion
Release consistency
Using memcached
Circuit
Summary
5. Locks, Blocks, and Better Channels
Understanding blocking methods in Go
Blocking method 1 – a listening, waiting channel
Sending more data types via channels
Creating a function channel
Using an interface channel
Using structs, interfaces, and more complex channels
The net package – a chat server with interfaced channels
Handling direct messages
Examining our client
Blocking method 2 – the select statement in a loop
Cleaning up goroutines
Blocking method 3 – network connections and reads
Creating channels of channels
Pprof – yet another awesome tool
Handling deadlocks and errors
Summary
6. C10K – A Non-blocking Web Server in Go
Attacking the C10K problem
Failing of servers at 10,000 concurrent connections
Using concurrency to attack C10K
Taking another approach
Building our C10K web server
Benchmarking against a blocking web server
Handling requests
Routing requests
Serving pages
Parsing our template
External dependencies
Connecting to MySQL
Multithreading and leveraging multiple cores
Exploring our web server
Timing out and moving on
Summary
7. Performance and Scalability
High performance in Go
Getting deeper into pprof
Parallelism's and concurrency's impact on I/O pprof
Using the App Engine
Distributed Go
Types of topologies
Type 1 – star
Type 2 – mesh
The Publish and Subscribe model
Serialized data
Remote code execution
Other topologies
Message Passing Interface
Some helpful libraries
Nitro profiler
Heka
GoFlow
Memory preservation
Garbage collection in Go
Summary
8. Concurrent Application Architecture
Designing our concurrent application
Identifying our requirements
Using NoSQL as a data store in Go
MongoDB
Redis
Tiedot
CouchDB
Cassandra
Couchbase
Setting up our data store
Monitoring filesystem changes
Managing logfiles
Handling configuration files
Detecting file changes
Sending changes to clients
Checking records against Couchbase
Backing up our files
Designing our web interface
Reverting a file's history – command line
Using Go in daemons and as a service
Checking the health of our server
Summary
9. Logging and Testing Concurrency in Go
Handling errors and logging
Breaking out goroutine logs
Using the LiteIDE for richer and easier debugging
Sending errors to screen
Logging errors to file
Logging errors to memory
Using the log4go package for robust logging
Panicking
Recovering
Logging our panics
Catching stack traces with concurrent code
Using the runtime package for granular stack traces
Summary
10. Advanced Concurrency and Best Practices
Going beyond the basics with channels
Building workers
Implementing nil channel blocks
Using nil channels
Implementing more granular control over goroutines with tomb
Timing out with channels
Building a load balancer with concurrent patterns
Choosing unidirectional and bidirectional channels
Using receive-only or send-only channels
Using an indeterminate channel type
Using Go with unit testing
GoCheck
Ginkgo and Gomega
Using Google App Engine
Utilizing best practices
Structuring your code
Documenting your code
Making your code available via go get
Keeping concurrency out of your packages
Summary
Index


微信扫一扫关注公众号

0 个评论

要评论图书请先登录注册

你也许想看:

Effective Monitoring and Alerting

《Effective Monitoring and Alerting》

Ligus, Slawek..2012-12

“The book describes data-driven approach to optimal monitorin...”

学术研究,你的成功之道

《学术研究,你的成功之道》

凌晓峰,杨强.清华大学出版社.2012-11

“《学术研究,你的成功之道》讲述你有过成为科学家的梦想吗?想走进科学家的生活一探究竟吗?想知道科学研究究竟隐藏着怎样的神秘...”

图解基础设施设计模式

《图解基础设施设计模式》

[日] NTT DATA集团.人民邮电出版社.2015-5

“基础设施设计模式是指将基础设施技术者们创造出的设计方式概念化、抽象化,同时给其命名(模式名),总结其特点与注意事项而形成...”

Vi iMproved (VIM)

《Vi iMproved (VIM)》

Steve Oualline.Sams.11 April, 2001

“Real Linux users don't use GUIs. No matter how popular, slic...”

Automate the Boring Stuff with Python

《Automate the Boring Stuff with Python》

Albert Sweigart.No Starch Press.2015-2-25

“”

Learning Scala

《Learning Scala》

Jason Swartz.O'Reilly Media.2014-12-28

“”

NFC:Arduino、Android与PhoneGap近场通信

《NFC:Arduino、Android与PhoneGap近场通信》

Tom Igoe(汤姆.伊戈),Don Coleman(唐.科尔曼),Brian Jepson(布莱恩.杰普森).电子工业出版社.2014-9-1

“《NFC:Arduino、Android与PhoneGap近场通信》将带你走入近场通信(NFC)的世界,这是一种快速发展...”

移动App测试实战

《移动App测试实战》

邱鹏,陈吉,潘晓明.机械工业出版社.2015-7-1

“本书由三位国内顶级互联网企业软件测试工程师联手打造,根据移动产品的特点,深入讲解了移动App测试的最佳实践,从移动互联网...”

深度实践KVM

《深度实践KVM》

肖力,汪爱伟,杨俊俊,赵德禄.机械工业出版社.2015-9-1

“虚拟化技术是大数据和云计算应用中的核心技术,经过几年的友展,KVM已经非常成熟和稳定,逐渐取代Xen等商业虚拟化技术和产...”

软件测试经验与教训

《软件测试经验与教训》

Cem Kaner,James Bach,Bret Pettichord.机械工业出版社.2004-1

“本书汇总了293条来自软件测试界顶尖专家的经验与建议,阐述了如何做好测试工作、如何管理测试,以及如何澄清有关软件测试的常...”

精通Linux(第2版)

《精通Linux(第2版)》

[美] Brian Ward.人民邮电出版社.2015-7

“本书讲解了Linux操作系统的工作机制以及运行Linux系统所需的常用工具和命令。根据系统启动的大体顺序,本书更深入地介...”

高性能电子商务平台构建

《高性能电子商务平台构建》

ShopNC产品部.机械工业出版社.2014-12

“中国领先的电商系统解决方案提供商ShopNC官方首次分享他们多年来开发电商平台的先进理念、核心技术和宝贵经验,本书将成为...”

Spark机器学习

《Spark机器学习》

彭特里思 (Nick Pentreath).人民邮电出版社.2015-9-1

“本书每章都设计了案例研究,以机器学习算法为主线,结合实例探讨了Spark 的实际应用。书中没有让人抓狂的数据公式,而是从...”

苹果生存手册

《苹果生存手册》

游雷.清华大学出版社.2009-8

“《苹果生存手册:Mac电脑达人速成》是一本全面介绍苹果电脑应用的书籍,不仅涵盖面广,内容也达到了足够的深度。《苹果生存手...”

领域驱动设计

《领域驱动设计》

Eric Evans.清华大学出版社.2006-3-1

“”

SQL语言艺术

《SQL语言艺术》

[美] StéphaneFaroult,P.电子工业出版社.2008-1

“资深 SQL 专家 Stéphane Faroult倾力打造 《软件架构设计》作者温昱最新译作 巧妙借鉴《孙子兵法》的智...”

SOA实践指南

《SOA实践指南》

Josuttis.N.M..电子工业出版社.2008

“《SOA实践指南:分布式系统设计的艺术》主要内容:多年来,SOA一直只是个美好的愿景。通过描述在实践中实现和运行SOA所...”

Creating a Data-Driven Organization

《Creating a Data-Driven Organization》

Carl Anderson.O'Reilly Media.2015-8-15

“”

DevOps故障排除

《DevOps故障排除》

Kyle Rankin.机械工业出版社.2014-4

“devops是一组过程、方法与系统的统称,用于促进开发者、质量保证人员(qa)以及系统管理员之间的沟通、协作与整合。在d...”

Build Your Own Lisp

《Build Your Own Lisp》

Mr Daniel Holden.CreateSpace Independent Publishing Platform.2014-10-22

“If you’ve ever wondered how to build your own programming la...”