'Performance'에 해당되는 글 6건

  1. 2019.11.07 [Logstash] 최적화 설정 정보
  2. 2014.08.11 [ElasticSearch] High CPU usage when idle #1940
  3. 2013.09.11 [Elasticsearch] Indexing performance by kimchy
  4. 2013.08.13 [Elasticsearch] threadpool 설정.
  5. 2009.01.07 [펌]웹페이지 성능 향상
  6. 2007.08.22 PHP Performance

[Logstash] 최적화 설정 정보

Elastic/Logstash 2019. 11. 7. 15:00

공식 문서에 잘 나와 있습니다.

https://www.elastic.co/guide/en/logstash/current/tuning-logstash.html

https://www.elastic.co/guide/en/logstash/current/performance-tuning.html

 

기본적으로 아래 두 개 설정만 잘 세팅 하셔도 성능 뽑아 낼 수 있습니다.

 

pipeline.workers)

이 설정 값은 그냥 기본으로 Core 수 만큼 잡아 주고 시작 하시면 됩니다.

 

pipeline.batch.size)

Worker thread 가 한 번에 처리 하기 위한 이벤트의 크기 입니다.
최적 크기는 직접 구하셔야 합니다.

결국 Elasticsearch 로 Bulk Request 를 보내기 위한 최적의 크기로 설정 한다고 보시면 됩니다.

 

이외 더 봐주시면 좋은 건

- CPU

- MEM

- I/O (Disk, Network)

- JVM Heap

:

[ElasticSearch] High CPU usage when idle #1940

Elastic/Elasticsearch 2014. 8. 11. 10:26

https://github.com/elasticsearch/elasticsearch/issues/1940

:

[Elasticsearch] Indexing performance by kimchy

Elastic/Elasticsearch 2013. 9. 11. 17:43

원본 : https://gist.github.com/duydo/2427158



If you want, I can try and help with pointers as to how to improve the indexing speed you get. Its quite easy to really increase it by using some simple guidelines, for example:

- Use create in the index API (assuming you can).
- Relax the real time aspect from 1 second to something a bit higher (index.engine.robin.refresh_interval).
- Increase the indexing buffer size (indices.memory.index_buffer_size), it defaults to the value 10% which is 10% of the heap.
- Increase the number of dirty operations that trigger automatic flush (so the translog won't get really big, even though its FS based) by setting index.translog.flush_threshold (defaults to 5000).
- Increase the memory allocated to elasticsearch node. By default its 1g.
- Start with a lower replica count (even 0), and then once the bulk loading is done, increate it to the value you want it to be using the update_settings API. This will improve things as possibly less shards will be allocated to each machine.
- Increase the number of machines you have so you get less shards allocated per machine.
- Increase the number of shards an index has, so it can make use of more machines.
- Make sure you make full use of the concurrent aspect of elasticsearch. You might not pushing it hard enough. For example, the map reduce job can index things concurrently. Just make sure not to overload elasticsearch.
- Make Lucene use the non compound file format (basically, each segment gets compounded into a single file when using the compound file format). This will increase the number of open files, so make sure you have enough. Set index.merge.policy.use_compound_file to false.

If not using Java, there are more things to play with:

- Try and use the thrift client instead of HTTP.


:

[Elasticsearch] threadpool 설정.

Elastic/Elasticsearch 2013. 8. 13. 18:51

[Server Side Setting]

- elasticsearch.yml

- http://edgeofsanity.net/article/2012/12/26/elasticsearch-for-logging.html


[threadpool bounded]

indices.memory.index_buffer_size: 50%


# Search pool

threadpool.search.type: fixed

threadpool.search.size: 20

threadpool.search.queue_size: 100

 

# Bulk pool

threadpool.bulk.type: fixed

threadpool.bulk.size: 60

threadpool.bulk.queue_size: 300

 

# Index pool

threadpool.index.type: fixed

threadpool.index.size: 20

threadpool.index.queue_size: 100


[threadpool unbounded]

threadpool.index.queue_size: -1


:

[펌]웹페이지 성능 향상

Legacy 2009. 1. 7. 13:30

http://msdn.microsoft.com/ko-kr/magazine/dd188562.aspx

 

한번 가볍게 읽어 보세요. ^^*

 

1.      충분한 포트 열기

2.      다운로드하는 작은 파일 수를 제한

3.      JavaScript 파일을 JavaScript 엔진 외부에서 로드

4.      연결 유지 사용

5.      네트워크 정체 현상 식별

6.      네트워크 MTU(최대 전송 단위) TCP 크기 늘리기

7.      서버 정체 현상 식별

8.      불필요한 왕복 확인

9.      만료 날짜 설정

10.  리디렉션에 대한 재고

11.  압축 사용

12.  CSS 편집

 

더불어 비교해서 야후 닷컴에 근무하는 친구(제 친구는 아니구요.. )가 쓴 책인데요.

http://stevesouders.com/examples/rules.php

http://video.yahoo.com/video/play?vid=1040890

:

PHP Performance

ITWeb/개발일반 2007. 8. 22. 14:46

Reference Blog

PHP Performance

  • 디렉토리나 파일은 가능한 짧게 유지 하라.
  • FollowSymLinks 옵션을 사용하라.
  • logging 은 한파일에 하고 분석시 logging 을 중지 하라.
  • KeepAliveTimeout 은 가능한 낮게 잡아라.
  • static / dynamic request 를 구분하라.
  • output buffering 은 브라우저의 rendering 을 빠르게 해준다.
    • ob_start()
    • output_buffering=on
    • SendBufferSize = PageSize ( in apache )
    • memory size 가 작은 시스템에서는 사용하지 말라.
for($i = 0; $i < 1000; $i++) { echo $i; }

This method is much slower than something like this:

ob_start(); for($i = 0; $i <1000; $i++) { echo $i; } ob_end_flush();

    • 1.36509799957 without ob_start()
    • .248747825623 with ob_start()
  • bandwidth optimization
    • server 자원을 줄인다.
    • client page load 를 빠르게 한다.
    • network io 를 줄인다.
  • compression 은 cpu 의 3-5% 의 load 를 줄인다.
    • apache 1 : mod_gzip
    • apache 2 : mod_deflate
  • Tuning PHP Configuration
    • register_globals = Off **
    • magic_quotes_gpc = Off
    • expose_php = Off
    • register_argc_argv = Off
    • always_populate_raw_post_data = Off **
    • session.use_trans_sid = Off **
    • session.auto_start = Off **
    • session.gc_divisor = 1000 or 10000
    • output_buffering = 4096
  • Tuning PHP File Access
    • Inefficient Approach : < ? php include "file.php"; ? >
    • Performance Friendly Approach : < ? php include "/path/to/file.php"; or include "./file.php"; ? >
  • Regular Expression
    • Slow
      • if (preg_match("!^foo_!i", "FoO_")) { }
      • if (preg_match("![a8f9]!", "sometext")) { }
    • Faster
      • if (strncasecmp("foo_", "FoO_", 4)) { }
      • if (strpbrk("a8f9", "sometext")) { }
  • Optimizing str_replace()
    • replacement 할 필요가 없는 것들을 제거 하고 사용할것
      • 바꿔야 할 문자열과 대치해야할 문자열 중 필요 없는건 제거 할것
  • strtr() vs str_replace()
    • str_replace 가 strtr 보다 10배 정도 빠르다.
  • fopen() vs file_get_contents()
    • file_get_contents() 가 훨씬 간단하고 빠르다.
  • 쓰면 유용한 함수들
    • file_put_contents()
      • Append data to files or create new files in one shot.
    • microtime() and gettimeofday()
      • Return floats when passed TRUE as a 1st argument.
    • mkdir()
      • Can create directory trees, when 2nd arg. is TRUE.
    • glob()
      • Fetch all array of files/directories in one shot.
    • convert_uuencode,convert_uudecode
      • Fast UU encoding/decoding mechanism.
    • http_build_query()
      • Build GET/POST query based on associated array.
    • substr_compare()
      • strcmp/strncasecmp/etc… from an offset.
    • array_walk_recursive()
      • Recursively iterate through an array.
    • convert_uuencode,convert_uudecode
      • Fast UU encoding/decoding mechanism.
    • http_build_query()
      • Build GET/POST query based on associated array.
    • substr_compare()
      • strcmp/strncasecmp/etc… from an offset.
    • array_walk_recursive()
      • Recursively iterate through an array.
  • Multi-dimensioal Array trick
    • slow 2 extra hash lookups per access
      • $a['b']['c'] = array();
      • for($i = 0; $i < 5; $i++) $a['b']['c'][$i] = $i;
    • much faster reference based approach
      • $ref =& $a['b']['c'];
      • for($i = 0; $i < 5; $i++) $ref[$i] = $i;
  • Static 선언은 50-75% 의 성능 향상을 준다.
  • 불필요한 wrapper 를 제거 한다.
  • The simpler the code, the faster it runs, it really is that simple.
  • string concatenation
    • echo ''; 보다 echo ''; 가 일반적이다.

  • include nested-looping 사용에 대한 주의
main
require_once
  php_self
require_once (2x)
  session_is_registered
  require_once
require_once
  require_once (3x)
    require_once (2x)
  require_once
    require_once
      require_once
        require_once
          is_array
          use_plugin
            file_exists
            include_once
            function_exists
            ... etc
As you can see, a require_once was performed and inside that a php_self was executed. Then another require_once executed session_is_registered, followed by another require_once and so on. Basically, the function call tree is like a little window into the Zend Engine, allowing you to watch the sequence of events that take place when your Web application is run.

If you do much object-oriented development, you may find that you rapidly lose track of what's actually going on inside some classes and methods. It's tempting to think of classes as a black box, because that's how we're taught to use them. But, when optimizing a complex Web application, you need to know what's actually going on inside each one, or you may have performance bottlenecks you do not even notice.

  • Avoid repeated function calls
    • for ( $i=0; $i<count($aArray); $i++ ) {} : bad
    • $nCnt = count($aArray); for ( $i=0; $i<$nCnt; $i++ ) {} : good
  • string concatenation
    • sprintf 보다 plain string concatenation 이 두배 정도 빠르다.
  • print() 대신 echo 를 사용 하라.
  • string 표현은 signle quotes 를 사용 하라.
  • Reduces Number Of System Calls (Optimizes PHP<->OS Communication)


: