igbinary - APC 와 Serialize / redis 을 사용하는 PHP 에 날개를 달자

· 10년 전 · 3015

[ 목적 ]

    속도 향상

 

[ 벤치마킹 ]

   http://codepoets.co.uk/2011/php-serialization-igbinary/ 

 

[ 설치 ]

    https://github.com/igbinary/igbinary 

 

  1) phpize

   2) php 에서 지원하기 위해서 컴파일 할때 아래처럼 

          ./configure CFLAGS="-O2 -g" --enable-igbinary --with-php-config="php-config 가 있는 위치"

          예) ./configure CFLAGS="-O2 -g" --enable-igbinary --with-php-config=/usr/local/php/bin/php-config

   3) make

   4) make install

   5) php.ini 에 추가

           [igbinary]

                extension=/usr/local/php/lib/php/extensions/~~/igbinary.so

                session.serialize_handler=igbinary

                ;session.serialize_handler = php    <---- 기존에 php.ini 에 있던 환경설정을 주석처리


                ; Enable or disable compacting of duplicate strings

                ; The default is On.

                igbinary.compact_strings=On


                ; Use igbinary as serializer in APC cache (3.1.7 or later)

                ;apc.serializer=igbinary    <--- apc 사용중이라면 활성화


[ Redis 사용을 하는 PHP 에 설치 ]  <---- Redis 가 먼저 설치된 경우 입니다.

       https://github.com/phpredis/phpredis


      1) phpize

   2) /configure --enable-redis-igbinary

   3) make

   4) make install  

   5) php.ini 에 추가

                extension=/usr/local/php/lib/php/extensions/~~/redis.so 


      (*) 참고

             바로 위의 Redis 을 설정 다하신 경우 session 을 Redis 로 설정하는 부분이 있습니다.

             하나의 사이트을 여러대의 서버로 운영하시는 경우 세션 공유을 이것으로도 해결 가능합니다.

             

            예)  session.save_handler = redis

                   session.save_path = "tcp://host1:6379?weight=1, tcp://host2:6379?weight=2&timeout=2.5"


[ Session 을 Redia 로 설정한 이후의 결과 화면 ]

55569a73128c9cc74063a750d8ebf729_1447698228_2629.png


출처 : http://blog.bengis.com/

 

 

|
댓글을 작성하시려면 로그인이 필요합니다. 로그인

서버관리자

서버관리자 모임 게시판 입니다.

+
제목 글쓴이 날짜 조회
10년 전 조회 3,068
10년 전 조회 1,360
10년 전 조회 2,866
10년 전 조회 2,221
10년 전 조회 1,746
10년 전 조회 3,323
10년 전 조회 2,785
10년 전 조회 3,199
10년 전 조회 1,940
10년 전 조회 2,488
10년 전 조회 2,552
10년 전 조회 2,285
10년 전 조회 2,632
10년 전 조회 1,652
10년 전 조회 3,016
10년 전 조회 1,767
10년 전 조회 2,026
10년 전 조회 4,117
10년 전 조회 1,297
10년 전 조회 2,391
10년 전 조회 1,792
10년 전 조회 1,892
10년 전 조회 2,251
10년 전 조회 4,199
10년 전 조회 1,906
10년 전 조회 1,980
10년 전 조회 1,691
10년 전 조회 3,818
10년 전 조회 2,490
10년 전 조회 6,291
🐛 버그신고