RSS feed [root] /design /weblog



title search:


Sun Oct 01 16:19:43 HKT 2017


(google search) (amazon search)
download zip of files only

Tue Jan 17 23:09:08 HKT 2017 From /weblog/design


(google search) (amazon search)

Tue Jan 17 22:58:18 HKT 2017 From /weblog/design


5 Hints You're Using A Map When You Should Be Using a Cache? -[..]ints-your-using-map-when-you-should.html

How hibernate design the cache -

Consider to do more careful update, not just update DB and dirty cache, but update DB and cache in a same time -

Caching can be architectural smell, some hint and some alternative -[..]2/is_caching_an_architectural_smell.html

General caching discussion -[..]are-architecture/caching-techniques.html[..]10-program-busting-caching-mistakes.html[..]B/web-cache/cachingmistakes.aspx?azid=74

(google search) (amazon search)

Wed Dec 07 18:48:22 HKT 2016 From /weblog/design

work with legacy

Simple ways to improve legacy code -

One approach to work with legacy code, instead of phrase by phrase or part by part, identify and improve the domain part first -[..]-efforts-to-replace-legacy-systems-fail/[..]egacy-applications-tests-modularization/

Note of common point for refactoring with legacy application -[..]/2016/10/unintentionally-obfuscated.html

(google search) (amazon search)

Tue Nov 29 00:12:57 HKT 2016 From /weblog/design/interview


"They build their own infrastructure for performance, reliability, and cost control reasons. By building it themselves they never have to say Amazon went down because it was company X's fault. Their software may not be more reliable than others, but they can fix, debug, and deployment much quicker than when working with a 3rd party."

Shel Kaphan -

(google search) (amazon search)

Tue Nov 15 10:53:50 HKT 2016 From /weblog/design

value object

Discussion of DTO -

Discussion of value object -

(google search) (amazon search)

Tue Nov 15 10:49:25 HKT 2016 From /weblog/design/concurrency


How to write safer concurrency code -

reentrant and thread safe functions -[..]/31/reentrant-and-thread-safe-functions/

Libraries / toolkits for multicore process -[..]intableArticle.jhtml?articleID=212900103

Introduction -[..]QQSNDLRSKHSCJUNN2JVN?articleID=212903586[..]CQSNDLRSKHSCJUNN2JVN?articleID=213001517

Collections of links -[..]rallel-Or-Get-Left-Behind.html&Itemid=29

Briefing of difference modeling of threading system -[..]intableArticle.jhtml?articleID=215900465[..]inners-guide-to-multithreaded-libraries/[..]haloms_blog/2010/08/concurrency-101.html

Saving the Failwhale: The Art of Concurrency (Page last updated December 2012, Added 2012-12-26, Author Dhanji R. Prasanna, Publisher informit). Tips:

1) Contention is unavoidable - some resources are just slower, and you must wait for them. The secrets to good concurrency are 1) ensuring that these slower resources are rarely used, and 2) during such waiting periods, giving the faster tiers other work to do so that they continue to be utilized well.
2) Overuse of synchronization constructs such as locks and mutexes leads to systems that perform poorly under load.
3) ConcurrentHashMap is an efficient thread-safe map while HashMap is not thread-safe.
4) ConcurrentHashMap doesn't do away with locks, it still uses them but it uses more than the single global lock, so that threads gain some measure of concurrency. It uses separate locks for partitions, so that multiple threads writing to the map are likely to access different partitions, using separate locks and therefore process their data simultaneously. This technique is known as lock-striping. Efficient striping uses a number of locks proportional to the number of CPU cores in a system.
5) The asynchronous processing model smooths resource spikes by adding requests to a queue which is serviced by a pool of workers - spikes in requests make the queue grow rather than overloading the workers. (The ExecutorService is essentially a thread pool accompanied by a task queue.)

Discussion of using difference model for concurrency -[..]cks-application-architecture-pros-a.html

Concurrency vs Parallelism -[..]/2013/12/concurrency-vs-parallelism.html

Compare between Actors, CSP, Disruptor and raw Threads -[..]omparision-of-different-concurrency.html

Few coding tips that should be useful for most languages -[..]erformance-scalability-and-liveness.html[..]2015/09/java-concurrency-essentials.html

Service Design
Do one thing, do it well
No shared operational state
Bound your queues
Name custom thread pools and register an UncaughtExceptionHandler
Prefer immutable data objects over mutable state[..]-to-25-billion-notifications-during.html

(google search) (amazon search)

Wed Nov 02 16:14:20 HKT 2016 From /weblog/design/pattern


understanding-retry-pattern-with-exponential-back-off-and-circuit-breaker-pattern -[..]al-back-off-and-circuit-breaker-pattern/

(google search) (amazon search)

Wed Nov 02 16:13:31 HKT 2016 From /weblog/design/concurrency


10-ways-to-reduce-lock-contention-in-threaded-programs -[..]ce-lock-contention-in-threaded-programs/

Discussion about lock the form and prevent 2 user edit it in the same time and currupt the object, what is the possible drawback. -[..]-optimistic-locking-isnt-a-silver-bullet

futexes -[..]ds/browse_thread/thread/3c3608a779dc6731

Spinning -[..]ome/lock-free-algorithms/tricks/spinning

Locks for rarely changed data, sound like good suggestion -[..]pic/comp.programming.threads/dyrbRKsj4gw

Try to use non-blocking approach if possible -[..]1/locks-condition-variables-latency.html

Concurrency without lock, and even without correctness? -

Single write principle -[..].au/2011/09/single-writer-principle.html

Comparing difference kind of locks again -[..]11/stampedlocktryoptimisticread-and.html

10-ways-to-reduce-lock-contention-in-threaded-programs -[..]ce-lock-contention-in-threaded-programs/

(google search) (amazon search)

Sun Oct 16 01:52:15 HKT 2016 From /weblog/design/interview


How yahoo use Hadoop for machine learning -

(google search) (amazon search)

Tue Sep 13 00:10:46 HKT 2016 From /weblog/design


*Do not use locks in the main transaction flow because they cause context switches, and therefore latency and unpredictable jitter.
*Never have more threads that need to run than you have cores available.
*Set affinity of threads to cores, or at least sockets, to avoid cache pollution by avoiding migration. This is particularly important when on a server class machine having multiple sockets because of the NUMA effect.
*Ensure uncontested access to any resource respecting the Single Writer Principle so that the likes of biased locking can be your friend.
*Keep call stacks reasonably small. Still more work to do here. If you are crazy enough to use Spring, then check out your call stacks to see what I mean! The garbage collector has to walk them finding reachable objects.
*Do not use finalizers.
*Keep garbage generation to modest levels. This applies to most JVMs but is likely not an issue for Zing.
*Ensure no disk IO on the main flow.
*Do a proper warm-up before beginning to measure.
*Do all the appropriate OS tunings for low-latency systems that are way beyond this blog. For example turn off C-States power management in the BIOS and watch out for RHEL 6 as it turns it back on without telling you!
*Macro-benchmarking is much more valuable than micro-benchmarking.
*Amazing results are achieved by truly agile companies, staffed by talented individuals, who are empowered to make things happen. Make sh*t happen is more important than following a process.[..]ughput-by-32x-and-reduce-latency-by.html[..]rything-you-know-about-latency-is-wrong/

How to monitor -[..]siness-value-from-performance-monitoring

How to measure latency -[..]/07/20/Latency-for-a-set-Throughput.html

Various cause of latency, and the solution -[..]Topics-in-High-Performance-Messaging.htm

(google search) (amazon search)

Fri Sep 09 16:00:46 HKT 2016 From /weblog/design/examples


How QQ deliver hotfix at Android -

(google search) (amazon search)

Wed Aug 17 00:06:59 HKT 2016 From /weblog/design/examples


How linkedin handle logs -[..]ould-know-about-real-time-datas-unifying

(google search) (amazon search)

Mon May 09 10:41:01 HKT 2016 From /weblog/design/distribute


In one sentence, here's why: humans are notoriously bad at keeping "self" distinct from "other". Egomania, projection (transference), and enmeshment are well-known symptoms of this problem. OK, so I hear you saying, "yeah, but what does this have to do with programming?" It certainly seems absurd to suggest that if we are bad at something we know the most about (our "selves"), how could we possibly say that we have a good approach for the programming analogues - objects, modules, etc. -

Argue why space base design is better than n-tier design -[..]0The%20End%20of%20Tier-based%20Computing

Some key research of google for distributed computation -

Someone think we are not yet (per Oct 2007) have good language support for distibuted computing -

A blog contain a lot distributed computing information -

How Wikipedia manage their site -

Google tutorial for Design Distributed System -

The Hadoop Distributed File System: Architecture and Design -[..]-a-list-of-distributed-key-value-stores/

Applying experience from CPU design for distributed solution -[..]o/post/26909672264/on-distributed-memory

Distributed systems for fun and profit -

Monitor and design -[..]buted-mission-critical-applications.html

Uber case study -[..]les-their-real-time-market-platform.html

Load balancer design -

Some issues of distributing logic to difference systems -[..]t-f-up-your-microservices-in-production/

(google search) (amazon search)

Wed Dec 09 11:20:40 HKT 2015 From /weblog/design


(google search) (amazon search)

Thu Dec 03 10:33:50 HKT 2015 From /weblog/design/interview


(google search) (amazon search)

Fri Nov 13 00:07:00 HKT 2015 From /weblog/design


It won't happened at java, but for non-GC language like C++, crash at constructor will cause memory leak:[..]oders-have-it-easy-crashing-constructors

Discussion of if there are way to recover OOME -[..]-a-Non-Recoverable-Error-.html&Itemid=29[..]ghly-available-inmemory-shard-index.html

Discussion about using memory as store -

When using direct memory can be faster, when you have a large amounts of data and/or you have to perform some IO with that data. Tick data is a good example -[..]n-using-direct-memory-can-be-faster.html

(google search) (amazon search)

Wed Sep 30 15:29:04 HKT 2015 From /weblog/design/pattern


Collection of patterns from objectmentor -[..]07/agile-scm-principles-from-ood-to.html

Robert Martin tutorial -

Links and abstract of few principle -

Tutorial about common anti-pattern -

Development of Further Patterns of Enterprise Application Architecture -

Expanation and C++/Java samples -

Java tutorial -

(google search) (amazon search)

Thu Sep 10 14:18:31 HKT 2015 From /weblog/design/interview

Martin Odersky

One of the challenges we were facing is we wanted to be both functional and object-oriented. We had very early on the notion that immutable objects would become very, very important. Nowadays everybody talks about immutable objects, because people think they are a key part of the solution to the concurrency problems caused by multi-core computers. Everybody says, no matter what you do, you need to try to have as much of your code using immutable objects as possible. In Scala, we did that very early on. Five or six years ago, we started to think very hard about immutable objects. It actually turns out that a lot of the object-oriented field up to then identified objects with mutability. For them, mutable state and objects were one and the same: mutable state was an essential ingredient of objects. We had to, in essence, ween objects off of that notion, and there were some things we had to do to make that happen.

(google search) (amazon search)

Sat Aug 15 23:06:06 HKT 2015 From /weblog/design


Introduction to AI of game -

How to create angry bird -[..]11/06/07/how-to-make-angry-birds-part-2/

How to program breast in game -[..]15/07/30/how-video-game-breasts-are-made[..]eveloper-nintendo-president-satoru-iwata

(google search) (amazon search)

Wed May 27 10:17:34 HKT 2015 From /weblog/design


When XP says "go for the simplest possible design", what does that mean?
1. Simplest possible design to IMPLEMENT?
1. Simplest possible design to UNDERSTAND LATER?

An thread discuss how far should we go. Seen most people agree what should be done is "Simplest possible design to TEST and IMPLEMENT"

It apply on feature, not on quality -

(google search) (amazon search)

Wed Dec 31 19:11:17 HKT 2014 From /weblog/design/concurrency


Case study of a parallel slowdown, and the analysis of how to find it out -[..]2/avoiding-parallel-slowdown-in-jetty-9/

Discuss about the racing condition when multiple accessing java.util.HashMap -[..]au/2009/06/beautiful-race-condition.html

(google search) (amazon search)