• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

New to ES - A few questions about optimising ES

Fred.

Well-known member
#1
Hi,

I'm new to Elasticsearch. I installed it and have it running on my test forum now.
I've set the memory settings in /etc/elasticsearch/jvm.options to
Code:
# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space

-Xms256m
-Xmx256m
Because it will be used on a small forum with less than 100 000 posts. And that should be enough. (I can set it higher if I want because I have more ram)

While it's only active on my test forum with no active usage I still see many processes and ram usage.
Is this normal?

This is what I mean
Screen Shot 2017-07-27 at 12.47.23 pm.png
 

kontrabass

Well-known member
#2
Looks fine to me, we use 2G heap size, the virtual memory requested is going to be about the same, the resident memory of our processes is 5363M. 20 million posts.
 

Xon

Well-known member
#4
@Fred the most important optimization is to use the latest version.

With just a single node, you want to disable the replica shards (ie having multiple copies of your data); For ElasticSearch 5v.x;
Code:
curl -XDELETE 'http://localhost:9200/_template/default'
curl -XPUT 'http://localhost:9200/_template/default' -d'{
"template": "*",
"settings": {
"number_of_replicas": "0"
}
}'
curl -XPUT 'http://localhost:9200/_settings' -d '{
"index" : { "number_of_replicas" : "0" }
}'
1st argument deletes any default template (since merging is a *****), 2nd builds a new one for any new indexes so they have zero replicas.

Last curl command changes any existing indexes.
 

Sunka

Well-known member
#6
@Fred the most important optimization is to use the latest version.

With just a single node, you want to disable the replica shards (ie having multiple copies of your data); For ElasticSearch 5v.x;
Code:
curl -XDELETE 'http://localhost:9200/_template/default'
curl -XPUT 'http://localhost:9200/_template/default' -d'{
"template": "*",
"settings": {
"number_of_replicas": "0"
}
}'
curl -XPUT 'http://localhost:9200/_settings' -d '{
"index" : { "number_of_replicas" : "0" }
}'
1st argument deletes any default template (since merging is a *****), 2nd builds a new one for any new indexes so they have zero replicas.

Last curl command changes any existing indexes.
@Xon
Just one question regarding your code.
We should do that in three steps? Right?
  1. execute curl -XDELETE 'http://localhost:9200/_template/default'
  2. then execute curl -XPUT 'http://localhost:9200/_template/default' -d'{"template": "*","settings": {"number_of_replicas": "0"}}'
  3. then execute curl -XPUT 'http://localhost:9200/_settings' -d '{"index" : { "number_of_replicas" : "0" }}'

If someone just copy/paste in cli all code or just one step it will do nothing right?
Like this:
Code:
curl -XPUT 'http://localhost:9200/_template/default' -d'{
"template": "*",
"settings": {
"number_of_replicas": "0"
}
}'
Maybe I am wrong, but in above case, should not that code be like this?
Code:
curl -XPUT 'http://localhost:9200/_template/default' -d'{ \
"template": "*", \
"settings": { \
"number_of_replicas": "0" \
} \
}'
or this
curl -XPUT 'http://localhost:9200/_template/default' -d'{"template": "*","settings": {"number_of_replicas": "0"}}'
 

Xon

Well-known member
#7
You do need to run each command separately, but it shouldn't matter if it is 1 line or not, as the ' character will extend the data entry over multiple lines.

At least with a bash shell. Other shell may vary :p