Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View andrefsp's full-sized avatar

andre da palma andrefsp

View GitHub Profile

A general rule of thumb we work with is:

  • Use the Oracle JVM, not OpenJDK. OpenJDK has a lot of issues with large amounts of memory
  • You'll want twice as much memory dedicated to the JVM as the index size is on disk. i.e. if your committed/optimized index is 20GB in size, you'll want 40GB of RAM + a little spare.
  • Use a good garbage collector, e.g.::

    JAVA_OPTS="${JAVA_OPTS} -XX:+UseConcMarkSweepGC -XX:+UseParNewGC"

  • Logging helps a LOT when shit is not working as expected::

    JAVA_OPTS="${JAVA_OPTS} -Xloggc:/var/log/tomcat6/log_GarbageCollection -XX:+PrintGCDetails -XX:+PrintGCTimeStamps"JAVA_OPTS="${JAVA_OPTS} -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/tomcat6/oom_log"

REMEMBER, CACHES NEED RAM. ALLOCATED MORE RAM TO THE JVM AS IS REQUIRED BASED ON YOUR CACHES.

@andrefsp
andrefsp / gist:5115772
Last active March 1, 2021 22:22
Simple way to inject custom parameters on a Django formset without using django.utils.functional.curry()
"""
Simple example on how to inject a custom user parameters onto a formset
and its forms.
curry(): https://github.com/django/django/blob/1.4.3/django/utils/functional.py#L9
Another answer on:
http://stackoverflow.com/questions/622982/django-passing-custom-form-parameters-to-formset
"""