Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Why did we choose to use GoLang

Peter Tilsen
December 02, 2015

Why did we choose to use GoLang

Peter Tilsen

December 02, 2015
Tweet

More Decks by Peter Tilsen

Other Decks in Technology

Transcript

  1. Challenge Continue with php Introduce 1mio things: - Boss/Worker model

    (gearman, etc) - POSIX threads (pthreads) - php 7.x - More caching - jit compilation (hhvm) - Find leaks - etc.
  2. Challenge The job - Rapidly expandable APIs - Highly performant

    APIs - Granular decoupling of APIs - Big data transformation (ETL) - (Mobile development)
  3. Solution First occurrence 2007/2009 Developed at google Robert Griesemer, Rob

    Pike and Ken Thompson Compiled, statically typed C like language
  4. Solution Simplicity - 25 keywords - Clear visibility definition -

    Easy dependency management - Packaging Steep learning curve
  5. Solution Characteristics - Strictly typed - Structs - Arrays, Slices,

    Maps - Multiple return values - Interfaces - GoRoutines, Channels - Garbage collection
  6. Solution Standard library (All) necessary functionality is part of standard

    lib - encoding/decoding (marshalling) - net http for servers - testing - io/util
  7. Solution ci Capabilities - deploy single artifact - cross platform

    compilation - no vm needed Increase development efficiency (short compilation time, fast cycle)
  8. Concurrency Concurrency Not just threading (parallelism) Q: Why did the

    multithreaded chicken cross the road? A: to To other side. get the — Jason Whittington
  9. Concurrency Concurrency Threading is an issue - Simultaneous shared data

    access is hard. - Thread scheduling is non-deterministic - “Race conditions”
  10. Concurrency Concurrency vs Parallelism “Concurrent multithreading systems give the appearance

    of several tasks executing at once, but these tasks are actually split up into chunks that share the processor with chunks from other tasks. In parallel systems, two tasks are actually performed simultaneously. Parallelism requires a multi-CPU system.” —Timing Java Threads by Allan Holub
  11. Concurrency Concurrency vs Parallelism So what is parallelism? “Programming as

    the simultaneous execution of (possibly related) computations.” — Rob Pike
  12. Concurrency Concurrency vs Parallelism So what is concurrency? “Programming as

    the composition of independently executing processes.” — Rob Pike
  13. Concurrency Concurrency vs Parallelism Composition of independent units is an

    issue “A property of systems in which several computations are executing simultaneously, and potentially interacting with each other.” — wikipedia.org
  14. Concurrency Why use go for concurrency? Python can concurrency java

    can concurrency but go is designed for concurrency
  15. Concurrency Parallelise Input CPU Task 2 Output CPU Task 1

    CPU Task 3 Input CPU Task 2 Output CPU Task 1 CPU Task 3
  16. Concurrency More throughput Input Temp store Output CPU Task 1

    CPU Task 1 Input Temp store Output CPU Task 1 CPU Task 1
  17. Concurrency Combine models Input Temp store Output CPU Task 2

    CPU Task 1 CPU Task 3 CPU Task 2 CPU Task 1 CPU Task 3
  18. Concurrency Parallelise Input Temp store Output CPU Task 2 CPU

    Task 1 CPU Task 3 CPU Task 2 CPU Task 1 CPU Task 3 Input Temp store Output CPU Task 2 CPU Task 1 CPU Task 3 CPU Task 2 CPU Task 1 CPU Task 3