CSP scenarios

Context

  • Singleton - sync.once

  • Handle 1st response from Race Condition-

    with Channel

  • Handle all response from Race Condition-

    with Channel

  • Object Pool- with buffered Channel

  • sync.Pool is not pool object

Singleton - sync.once

Java

Go

Handle 1st response from Race Condition-

with Channel

Memory Leak on Go Routine

Channel

unbuffered vs bufferd

Handle all response from Race Condition-

with Channel

Object Pool-

with buffered Channel

Scenario

 

High Cost for creating instance,

like: DB connection, network connection...

Avoid create duplicated

Buffer Size == Pool Size

Handle Timout

get

relase

Diff pool for diff cache

sync.Pool

is not pool object

more like cache for 1 Object

Title Text

CSP

By Matt Jhou

CSP

  • 143