download zip of files only
Tue Apr 23 23:31:01 HKT 2013
From /weblog/design/concurrency
Stealing thread - http://badamczewski.blogspot.com.au/2012/05/work-stealing.html Intel Guide for Developing Multithreaded Applications - http://software.intel.com[..]or-developing-multithreaded-applications Difference ways to stop a thread - http://www.ddj.com[..]ept_url=/hpc-high-performance-computing/ Interesting, I am not sure if I agree, but chrome ( which use fork ) are really cool in performance: There’s another problem with Unix programming in Ruby that I’ll just touch on briefly: Java people and Windows people. They’re going to tell you that fork(2) is bad because they don’t have it on their platform, or it sucks on their platform, or whatever, but it’s cool, you know, because they have native threads, and threads are like, way better anyways.
Fuck that.
Don’t ever let anyone tell you that fork(2) is bad. Thirty years from now, there will still be a fork(2) and a pipe(2) and a exec(2) and smart people will still be using them to solve hard problems reliably and predictably, just like they were thirty years ago.
MRI Ruby people need to accept, like Python (you have seen multiprocessing, yes?), that Unix processes are one of two techniques for achieving reliable concurrency and parallelism in server applications. Threads are out. You can use processes, or async/events, or both processes and async/events, but definitely not threads. Threads are out. http://tomayko.com/writings/unicorn-is-unix 1x1 win M*N - http://binkley.blogspot.com/2012/01/1-1-beats-n-m.html Best number of threads: N = number of CPUs U = target CPU utilization (0 <= U <= 1) W/C = ration of wait time to cpu time (measured through profiling) threads = N * U * (1 + W/C) - http://www.ibm.com/developerworks/library/j-jtp0730.html http://stackoverflow.com[..]ratio-of-java-threads-to-cpus-on-solaris Threads Basics - http://www.hpl.hp.com/techreports/2009/HPL-2009-259html.html http://www.hpl.hp.com/personal/Hans_Boehm/c++mm/threadsintro.html
(google search)
(amazon search)
Fri Apr 05 17:31:38 HKT 2013
From /weblog/design/concurrency
How to write safer concurrency code - http://www.artima.com/forums/flat.jsp?forum=276&thread=178345 reentrant and thread safe functions - http://kevinrodrigues.com[..]/31/reentrant-and-thread-safe-functions/ Libraries / toolkits for multicore process - http://www.ddj.com[..]intableArticle.jhtml?articleID=212900103 Introduction - http://www.ddj.com[..]QQSNDLRSKHSCJUNN2JVN?articleID=212903586 http://www.ddj.com[..]CQSNDLRSKHSCJUNN2JVN?articleID=213001517 Collections of links - http://dobbscodetalk.com[..]rallel-Or-Get-Left-Behind.html&Itemid=29 Briefing of difference modeling of threading system - http://www.ddj.com[..]intableArticle.jhtml?articleID=215900465 http://software.intel.com[..]inners-guide-to-multithreaded-libraries/ http://natishalom.typepad.com[..]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.) http://www.informit.com/articles/article.aspx?p=1994789 Discussion of using difference model for concurrency - http://highscalability.com[..]cks-application-architecture-pros-a.html
(google search)
(amazon search)
Wed Apr 03 16:29:59 HKT 2013
From /weblog/design
Tired with duplicating Try-Catch for resource acquisition? Can try to create proxy method - http://hamletdarcy.blogspot.com[..]clarative-synchronization-with-java.html Discussion of naming of if block - http://blog.objectmentor.com/articles/2008/09/26/if-methods-redux Factors for choosing a strategic technology stack, runtime performance is not a factor for him, probably good idea - http://jchyip.blogspot.com[..]1/04/factors-for-choosing-strategic.html Don't think , stay focus - http://www.threeriversinstitute.org/blog/?p=594 Using class name as variable name is a bad thing? I doubt about it, but interesting idea - http://www.warski.org/blog/2013/01/dry-parameter-names/ The problem of using generic name - http://martinfowler.com/bliki/TransparentCompilation.html
(google search)
(amazon search)
Fri Mar 08 08:50:44 HKT 2013
From /weblog/design
This is a message from a management blog, but I think the arguement is also apply API design. In fact, I think most critical difference of good and bad API is knowing which small detail is important and which is not - http://www.goodproductmanager.com[..]er.com/2007/11/08/sweat-the-small-stuff/ Design tips: http://www.artima.com/weblogs/viewpost.jsp?thread=142428 http://openide.netbeans.org/tutorial/api-design.html http://www.cincomsmalltalk.com[..]gView?showComments=true&entry=3258158706 http://today.java.net[..]its-of-highly-profitable-developers.html http://www.infoq.com/news/2007/08/why-api-design-matters http://www.infoq.com/presentations/effective-api-design http://neuroning.com/2006/11/19/on-api-design-guidelines About Compatibility issues http://wiki.eclipse.org/Evolving_Java-based_APIs A blog of using interfaces-vs-abstract-classes http://hoskinator.blogspot.com[..]6/04/interfaces-vs-abstract-classes.html XOM design overview - http://www.xom.nu/designprinciples.xhtml#d0e309 You need to identify the business value but not pick any tools/design just because it is cool - http://myarch.com/what-is-good-soa A lot of links here - http://kasparov.skife.org/blog-live/src/api-design-refs.writeback http://discuss.joelonsoftware.com/default.asp?design.4.527465 An introduction of good OSS project to study their source - http://techkriti.wordpress.com[..]com/2007/06/28/learning-from-the-source/ CCCCDPIPE - http://blog.objectmentor.com/articles/2007/08/02/which-came-first Discussion of why getting feedback quick is important - http://blog.objectmentor.com[..]u-dont-know-until-you-take-the-next-step Someone saying that routines is the greatest invention in CS, I agree - http://www.codinghorror.com/blog/archives/001129.html New way of modeling system then layering, The Onion Architecture - http://jeffreypalermo.com/blog/the-onion-architecture-part-1/ SOLID - http://www.lostechies.com[..]of-the-month-march-solid-principles.aspx http://dotnet.dzone.com/news/solid-software-works <-- very good picture! http://www.blackwasp.co.uk/SOLIDPrinciples.aspx Idempotent, Orthogonality, Immutability - http://www.codinghorror.com/blog/archives/001244.html Some example of how to driven good API - http://jdegoes.squarespace.com[..]al/2009/5/11/good-api-design-part-3.html It's not enough to write tests for an API you develop, you have to write unit tests for code that uses your API. When you do, you learn first-hand the hurdles that your users will have to overcome when they try to test their code independently. http://butunclebob.com[..]MichaelFeathers.TheGoldenRuleOfApiDesign Active interface vs. Passive interface, for me this is another way to under "Tell, don't ask" - http://code-o-matic.blogspot.com[..]-on-api-design-call-stack-as-source.html The Principles of Good Programming - http://www.artima.com/weblogs/viewpost.jsp?thread=331531 http://net.tutsplus.com[..]software-principles-you-must-understand/ Difference choice of how API evolute with change - http://blog.jooq.org[..]sive-api-evolution-with-java-interfaces/ JUnit's evolving structure. - http://edmundkirwan.com/general/junit.html
(google search)
(amazon search)
Sat Mar 02 17:01:24 HKT 2013
From /weblog/design
Contain resource of measurable code metric information - http://thediscoblog.com[..]20/code-quality-for-software-architects/ Meaningful Metrics - http://www.developsense.com/2009/01/meaningful-metrics.html http://programmers.stackexchange.com[..]ions/115839/how-clean-should-new-code-be Guidelines for a more appropriate use of metrics Explicitly link metrics to goals Favor tracking trends over absolute numbers Use shorter tracking periods Change metrics when they stop driving change http://martinfowler.com/articles/useOfMetrics.html
(google search)
(amazon search)
Thu Jan 31 23:26:25 HKT 2013
From /weblog/design/distribute
There are two key primary ways of scaling web applications which is in practice today. 1) “Vertical Scalability” - Adding resource within the same logical unit to increase capacity. An example of this would be to add CPUs to an existing server, or expanding storage by adding hard drive on an existing RAID/SAN storage. 2) “Horizontal Scalability” - Adding multiple logical units of resources and making them work as a single unit. Most clustering solutions, distributed file systems, load-balancers help you with horizontal scalability. Scalability can be further sub-classified based on the “scalability factor”. 1) If the scalability factor stays constant as you scale. This is called “linear scalability“. 2) But chances are that some components may not scale as well as others. A scalability factor below 1.0 is called “sub-linear scalability“. 3) Though rare, its possible to get better performance (scalability factor) just by adding more components (i/o across multiple disk spindles in a RAID gets better with more spindles). This is called “supra-linear scalability“. 4) If the application is not designed for scalability, its possible that things can actually get worse as it scales. This is called “negative scalability“. http://www.royans.net/arch/2007/09/22/what-is-scalability/ Report of building web application with 55k pageload with rail - http://shanti.railsblog.com[..]mongrels-handled-a-550k-pageview-digging XMPP a IM protocol about scalability - http://www.process-one.net[..]icle/the_aol_xmpp_scalability_challenge/ Presentation and resources of making you website more scalable - http://www.scribd.com[..]9/Real-World-Web-Performance-Scalability http://www.theserverside.com[..]lications&asrc=EM_NLN_3990118&uid=703565 http://www.theserverside.com[..]ionsPart2&asrc=EM_NLN_3990119&uid=703565 Brian Zimmer, architect at travel startup Yapta, highlights some worst practices jeopardizing the growth and scalability of a system: * The Golden Hammer. Forcing a particular technology to work in ways it was not intended is sometimes counter-productive. Using a database to store key-value pairs is one example. Another example is using threads to program for concurrency. * Resource Abuse. Manage the availability of shared resources because when they fail, by definition, their failure is experienced pervasively rather than in isolation. For example, connection management to the database through a thread pool. * Big Ball of Mud. Failure to manage dependencies inhibits agility and scalability. * Everything or Something. In both code and application dependency management, the worst practice is not understanding the relationships and formulating a model to facilitate their management. Failure to enforce diligent control is a contributing scalability inhibiter. * Forgetting to check the time. To properly scale a system it is imperative to manage the time alloted for requests to be handled. * Hero Pattern. One popular solution to the operation issue is a Hero who can and often will manage the bulk of the operational needs. For a large system of many components this approach does not scale, yet it is one of the most frequently-deployed solutions. * Not automating. A system too dependent on human intervention, frequently the result of having a Hero, is dangerously exposed to issues of reproducibility and hit-by-a-bus syndrome. * Monitoring. Monitoring, like testing, is often one of the first items sacrificed when time is tight. http://highscalability.com/scalability-worst-practices Useful Corporate Blogs that Talk About Scalability - http://highscalability.com[..]l-corporate-blogs-talk-about-scalability Overview of mapreduce and how it compare with other distributed programming model -http://natishalom.typepad.com[..]0/is-mapreduce-going-to-main-stream.html Paper of data store at amazon http://www.allthingsdistributed.com/2007/10/amazons_dynamo.html Discuss how haven't sync can cause performance issue - http://www.theserverside.com[..]lications&asrc=EM_NLN_6273194&uid=703565 http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6423457 Discussion about Cloud Based Memory Architectures - http://highscalability.com[..]ased-memory-architectures-next-big-thing http://highscalability.com[..]alability-and-performance-best-practices Interview with google engineer - http://www.zdnet.co.uk[..]gle-at-scale-everything-breaks-40093061/ Surprisingly youtube is blocking - http://highscalability.com[..]e-scalability-lessons-in-30-minutes.html If we are seeing a sustained arrival rate of requests, greater than our system is capable of processing, then something has to give. Having the entire system degrade is not the ideal service we want to give our customers. A better approach would be to process transactions at our systems maximum possible throughput rate, while maintaining a good response time, and rejecting requests above this arrival rate. - http://mechanical-sympathy.blogspot.com.au[..]apply-back-pressure-when-overloaded.html How twitter scaling - http://www.infoq.com/presentations/Twitter-Analytics
(google search)
(amazon search)
Tue Jan 29 10:35:26 HKT 2013
From /weblog/design
A nice table:
| Do
|
Don't
|
| 1. Focus on interfaces. |
2. Be worried about the implementation. |
| 3. Mention semantic contract using interfaces. |
4. Let subtypes break this semantic contract of their parent types. |
| 5. Service decoupling using interfaces. |
6. Be coupled with specific concrete implementation. |
| 7. Family extension using interfaces. |
8. Break the family relationship using concrete implementation. |
| 9. Establish a family rule by abstract classes. |
10. Impose your own rule through concrete classes. |
| 11. Let interfaces answer all "what" about the system. |
12. Forget to mention "how" are you answering all "what" from interfaces. |
Also a good introduction of Strategy pattern
http://today.java.net[..]/03/28/testing-java-object-oriented.html
How to determine the levels of abstraction - http://programmers.stackexchange.com[..]w-to-determine-the-levels-of-abstraction
Simple and clear, good design -> Correct, clear, easy to change - http://randomartifacts.blogspot.com.au[..]rrectness-clarity-and-changeability.html
(google search)
(amazon search)
Mon Jan 21 17:07:23 HKT 2013
From /weblog/design
Agile Models Distilled: Potential Artifacts for Agile Modeling - http://www.agilemodeling.com/artifacts/ Difference between Association, Composition, Aggregation, Dependency, Abstraction, Realization, Generalization - http://techie-experience.blogspot.gr[..]1/quick-summary-object-associations.html
(google search)
(amazon search)
Sun Jan 20 01:35:15 HKT 2013
From /weblog/design
"Bad programmers worry about the code. Good programmers worry about data structures and their relationships." - http://programmers.stackexchange.com[..]uote-about-good-programmer/163187#163187 Compare between schema and schema=less ( like key value mapping ) data - http://martinfowler.com/articles/schemaless/
(google search)
(amazon search)
Sun Jan 06 18:17:22 HKT 2013
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. - http://www.artima.com/weblogs/viewpost.jsp?thread=46706 Argue why space base design is better than n-tier design - http://www.google.com[..]0The%20End%20of%20Tier-based%20Computing Some key research of google for distributed computation - http://www.infoq.com/news/2007/06/google-scalability Someone think we are not yet (per Oct 2007) have good language support for distibuted computing - http://kasparov.skife.org/blog/2007/10/11/ A blog contain a lot distributed computing information - http://www.highscalability.com/ How Wikipedia manage their site - http://dammit.lt/uc/workbook2007.pdf Google tutorial for Design Distributed System - http://code.google.com/edu/parallel/dsd-tutorial.html http://en.wikipedia.org/wiki/Distributed_hash_table The Hadoop Distributed File System: Architecture and Design - http://hadoop.apache.org/core/docs/r0.18.0/hdfs_design.html http://www.metabrew.com[..]-a-list-of-distributed-key-value-stores/ Applying experience from CPU design for distributed solution - http://blog.paralleluniverse.co[..]o/post/26909672264/on-distributed-memory
(google search)
(amazon search)
Tue Jan 01 18:37:57 HKT 2013
From /weblog/design
It won't happened at java, but for non-GC language like C++, crash at constructor will cause memory leak: http://blogs.asman-it.com.au[..]oders-have-it-easy-crashing-constructors Discussion of if there are way to recover OOME - http://dobbscodetalk.com[..]-a-Non-Recoverable-Error-.html&Itemid=29 http://blog.maxindelicato.com[..]ghly-available-inmemory-shard-index.html Discussion about using memory as store - http://martinfowler.com/bliki/MemoryImage.html 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 - http://vanillajava.blogspot.com.au[..]n-using-direct-memory-can-be-faster.html
(google search)
(amazon search)
|