<commit_before>// build_options: 
Remote services
===============
<NAME> <<EMAIL>>
v0.1, 23-Nov-2016: Draft version
:backend: slidy
:data-uri:
ifdef::env-build[:icons: font]
:extension: adoc
//extension may be overriden by compile.sh
ifeval::["{extension}"!="pdf"]
:doctitle: Good Programming Practices for Performance - {doctitle}
:lastpage: lastpage.adoc.include
endif::[]
:copyright: Creative-Commons-Zero (<NAME>)

Content
-------

* <<_ejb,EJB>>
* <<_other_advices,Other advices>>
* <<_caching,Caching>>

_(link:0.1-training_plan.{extension}#_best_practices[back to plan])_


EJB
---

NOTE: Don't use Remote EJB if not needed (performance impact!)

* Remote EJB entails serialization/deserialization
* Prefer local EJB


Other advices
-------------

* -> use caches for slow services
* set your timeouts!
* use async services if you can
* use connections/clients pool
* consider using a circuit breaker
 https://en.wikipedia.org/wiki/Circuit_breaker_design_pattern


Caching
-------

NOTE: Avoid using any custom-made cache.

* There are potential issues with caches (stuck threads, memory leaks)
* Use only recommended out-of-the-shelf solution (RB has approved usage of Inifinispan for local caches)
* Discuss it with solution board
* Do not use a HashMap to share information between several threads:
** you cannot make it synchronized (see above, <<_concurrency,Concurrency>>)
** and, when it's not synchronized, there is a risk of infinite loop with Java version < 8 (http://bugs.java.com/view_bug.do?bug_id=7027300) (see also, for example, https://dzone.com/articles/java-7-hashmap-vs)


include::{lastpage}[]<commit_msg>fix(services): fix link<commit_after>// build_options: 
Remote services
===============
<NAME> <<EMAIL>>
v0.1, 23-Nov-2016: Draft version
:backend: slidy
:data-uri:
ifdef::env-build[:icons: font]
:extension: adoc
//extension may be overriden by compile.sh
ifeval::["{extension}"!="pdf"]
:doctitle: Good Programming Practices for Performance - {doctitle}
:lastpage: lastpage.adoc.include
endif::[]
:copyright: Creative-Commons-Zero (<NAME>)

Content
-------

* <<_ejb,EJB>>
* <<_other_advices,Other advices>>
* <<_caching,Caching>>

_(link:0.1-training_plan.{extension}#_best_practices[back to plan])_


EJB
---

NOTE: Don't use Remote EJB if not needed (performance impact!)

* Remote EJB entails serialization/deserialization
* Prefer local EJB


Other advices
-------------

* -> use caches for slow services
* set your timeouts!
* use async services if you can
* use connections/clients pool
* consider using a circuit breaker
 https://en.wikipedia.org/wiki/Circuit_breaker_design_pattern


Caching
-------

NOTE: Avoid using any custom-made cache.

* There are potential issues with caches (stuck threads, memory leaks)
* Use only recommended out-of-the-shelf solution (RB has approved usage of Inifinispan for local caches)
* Discuss it with solution board
* Do not use a HashMap to share information between several threads:
** you should not make it synchronized (see section link:3,5-contentions.{extension}#jee[Contentions] about Java EE constraintes)
** and, when it's not synchronized, there is a risk of infinite loop with Java version < 8 (http://bugs.java.com/view_bug.do?bug_id=7027300) (see also, for example, https://dzone.com/articles/java-7-hashmap-vs)


include::{lastpage}[]
{'fraction_non_alphanumeric': 0.13826269912834385, 'fraction_numerical': 0.012022843402464683, 'mean_word_length': 4.777777777777778, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5372928', 'n_tokens_mistral': 1103, 'n_tokens_neox': 1028, 'n_words': 339}