Trang 1 / 6 1234 ... LastLast
Hiển thị kết quả từ 1 đến 10 / 58
  1. #1
    Tham gia
    21-04-2009
    Bài viết
    238
    Like
    0
    Thanked 0 Times in 0 Posts

    VPS có 2 sites mà web chết tèo

    Tôi vừa mua cái VPS, chỉ host nhõn 2 cái web mà web cứ chết lên chết xuống, SSH, Top thì thành thế này

    top - 05:22:08 up 9 days, 12:05, 1 user, load average: 34.51, 29.38, 19.35
    Tasks: 311 total, 14 running, 297 sleeping, 0 stopped, 0 zombie
    Cpu(s): 90.4%us, 9.6%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
    Mem: 1572864k total, 1567052k used, 5812k free, 0k buffers
    Swap: 0k total, 0k used, 0k free, 0k cached

    PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
    26198 mysql 16 0 77884 37m 3448 R 10.0 2.5 0:00.70 mysqld
    30058 mysql 16 0 77884 37m 3448 R 10.0 2.5 0:00.30 mysqld
    28364 mysql 16 0 77884 37m 3448 D 9.6 2.5 0:00.68 mysqld
    30048 mysql 16 0 77884 37m 3448 R 9.6 2.5 0:00.29 mysqld
    30176 mysql 16 0 77884 37m 3448 S 7.0 2.5 0:00.39 mysqld
    25914 mysql 16 0 77884 37m 3448 D 6.6 2.5 0:00.54 mysqld
    30175 mysql 16 0 77884 37m 3448 S 4.3 2.5 0:00.40 mysqld
    29729 mysql 16 0 77884 37m 3448 D 4.0 2.5 0:00.26 mysqld
    17525 ht 16 0 41028 25m 5048 S 3.3 1.6 0:00.68 php-cgi
    7643 avtfo 16 0 39540 25m 5164 S 3.0 1.7 0:01.53 php-cgi
    9547 ht 16 0 40516 25m 5284 S 2.0 1.7 0:01.42 php-cgi
    13929 ht 16 0 41772 25m 5280 S 2.0 1.7 0:01.30 php-cgi
    28583 ht 16 0 40316 22m 4656 S 2.0 1.5 0:00.50 php-cgi
    5824 avtfo 15 0 41532 26m 5300 S 1.7 1.7 0:01.26 php-cgi
    11328 avtfo 16 0 42696 26m 5296 S 1.7 1.7 0:01.29 php-cgi
    19488 avtfo 16 0 40480 25m 5268 S 1.7 1.6 0:00.90 php-cgi
    15404 avtfo 15 0 41544 26m 5300 S 1.3 1.7 0:00.62 php-cgi

    Thấy mọi người ở đây đều chỉ có load everage dưới 1, của tôi lên đến tận hơn 30, rồi CPU usage thì tận 90%, web chết liên tục.

    Không hiểu lý do gì nữa.

    Free -m thì là thế này

    [root@server1 ~]# free -m
    total used free shared buffers cached
    Mem: 1536 1040 495 0 0 0
    -/+ buffers/cache: 1040 495
    Swap: 0 0 0

    Đã optimize trong etc/my.cnf mà chả ăn thua
    Chán quá, xin các đồng chí cho ý kiến giúp
    Quote Quote

  2. #2
    Tham gia
    31-08-2002
    Location
    Trái đất
    Bài viết
    1,910
    Like
    11
    Thanked 60 Times in 50 Posts
    VPS chạy quá nhiều processes. Thường thì chỉ cần 1 mysqld là đủ. Cái này phải coi lại khâu code site và config server.

  3. #3
    Tham gia
    29-02-2004
    Bài viết
    3,942
    Like
    0
    Thanked 12 Times in 11 Posts
    CPU bao nhiêu core mà bro cho mysql chạy quá trời vậy :| Sẵn tiện post toàn bộ file my.cnf cho mọi người tham khảo xem.

  4. #4
    Tham gia
    21-04-2009
    Bài viết
    238
    Like
    0
    Thanked 0 Times in 0 Posts
    Site làm bằng Joomla, tôi đã cài loạn các extension để tối ưu hóa rồi mà vẫn thế. Đây là file my.cnf

    # Example MySQL config file for medium systems.

    # This is for a system with little memory (32M - 64M) where MySQL plays
    # an important part, or systems up to 128M where MySQL is used together with
    # other programs (such as a web server)
    #
    # You can copy this file to
    # /etc/my.cnf to set global options,
    # mysql-data-dir/my.cnf to set server-specific options (in this
    # installation this directory is /var/lib/mysql) or
    # ~/.my.cnf to set user-specific options.
    #
    # In this file, you can use all long options that a program supports.
    # If you want to know which options a program supports, run the program
    # with the "--help" option.

    # The following options will be passed to all MySQL clients
    [client]
    #password = your_password
    port = 3306
    socket = /var/lib/mysql/mysql.sock

    # Here follows entries for some specific programs

    # The MySQL server
    [mysqld]
    max_connections = 400
    port = 3306
    socket = /var/lib/mysql/mysql.sock
    skip-locking
    key_buffer = 64M
    max_allowed_packet = 16M
    table_cache = 4000
    sort_buffer_size = 2M
    net_buffer_length = 8K
    read_buffer_size = 1M
    read_rnd_buffer_size = 2M
    myisam_sort_buffer_size = 32M
    join_buffer_size = 1M
    thread_cache_size = 286
    interactive_timeout = 10
    max_connect_errors = 10
    query_cache_limit = 2M
    query_cache_size = 12M
    query_cache_type = 1
    tmp_table_size = 16M
    skip-innodb
    log-slow-queries = /var/log/mysql/mysql-slow.log
    long_query_time = 1
    [mysqld_safe]
    open_files_limit = 8192
    # Don't listen on a TCP/IP port at all. This can be a security enhancement,
    # if all processes that need to connect to mysqld run on the same host.
    # All interaction with mysqld must be made via Unix sockets or named pipes.
    # Note that using this option without enabling named pipes on Windows
    # (via the "enable-named-pipe" option) will render mysqld useless!
    #
    #skip-networking

    # Disable Federated by default
    skip-federated

    # Replication Master Server (default)
    # binary logging is required for replication
    log-bin=mysql-bin

    # required unique id between 1 and 2^32 - 1
    # defaults to 1 if master-host is not set
    # but will not function as a master if omitted
    server-id = 1
    # Replication Slave (comment out master section to use this)
    #
    # To configure this host as a replication slave, you can choose between
    # two methods :
    #
    # 1) Use the CHANGE MASTER TO command (fully described in our manual) -
    # the syntax is:
    #
    # CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
    # MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
    #
    # where you replace <host>, <user>, <password> by quoted strings and
    # <port> by the master's port number (3306 by default).
    #
    # Example:
    #
    # CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
    # MASTER_USER='joe', MASTER_PASSWORD='secret';
    #
    # OR
    #
    # 2) Set the variables below. However, in case you choose this method, then
    # start replication for the first time (even unsuccessfully, for example
    # if you mistyped the password in master-password and the slave fails to
    # connect), the slave will create a master.info file, and any later
    # change in this file to the variables' values below will be ignored and
    # overridden by the content of the master.info file, unless you shutdown
    # the slave server, delete master.info and restart the slaver server.
    # For that reason, you may want to leave the lines below untouched
    # (commented) and instead use CHANGE MASTER TO (see above)
    #
    # required unique id between 2 and 2^32 - 1
    # (and different from the master)
    # defaults to 2 if master-host is set
    # but will not function as a slave if omitted
    #server-id = 2
    #
    # The replication master for this slave - required
    #master-host = <hostname>
    #
    # The username the slave will use for authentication when connecting
    # to the master - required
    #master-user = <username>
    #
    # The password the slave will authenticate with when connecting to
    # the master - required
    #master-password = <password>
    #
    # The port the master is listening on.
    # optional - defaults to 3306
    #master-port = <port>
    #
    # binary logging - not required for slaves, but recommended
    #log-bin=mysql-bin

    # Point the following paths to different dedicated disks
    #tmpdir = /tmp/
    #log-update = /path-to-dedicated-directory/hostname

    # Uncomment the following if you are using BDB tables
    #bdb_cache_size = 4M
    #bdb_max_lock = 10000

    # Uncomment the following if you are using InnoDB tables
    #innodb_data_home_dir = /var/lib/mysql/
    #innodb_data_file_path = ibdata1:10M:autoextend
    #innodb_log_group_home_dir = /var/lib/mysql/
    #innodb_log_arch_dir = /var/lib/mysql/
    # You can set .._buffer_pool_size up to 50 - 80 %
    # of RAM but beware of setting memory usage too high
    #innodb_buffer_pool_size = 16M
    #innodb_additional_mem_pool_size = 2M
    # Set .._log_file_size to 25 % of buffer pool size
    #innodb_log_file_size = 5M
    #innodb_log_buffer_size = 8M
    #innodb_flush_log_at_trx_commit = 1
    #innodb_lock_wait_timeout = 50

    [mysqldump]
    quick
    max_allowed_packet = 16M

    [mysql]
    no-auto-rehash
    # Remove the next comment character if you are not familiar with SQL
    #safe-updates

    [isamchk]
    key_buffer = 64M
    sort_buffer_size = 2M
    read_buffer = 16M
    write_buffer = 16M

    [myisamchk]
    key_buffer = 64M
    sort_buffer_size = 64M
    read_buffer = 16M
    write_buffer = 16M

    [mysqlhotcopy]
    interactive-timeout

    Cấu hình VPS thì thế này:
    Intel Core i7/Core i5
    50% Core/4 Core

    Lạ cái là ban ngày thì site khá nhanh, nhưng cứ đến tối là chậm và thậm chí Internal Server Error luôn.

    Site thì 1 cái khoảng 2k visit/ngày, 30 user online
    1 cái giờ chỉ khoảng 300 visit/ngày

    Có chạy lệnh cronjob để lấy tin tự động

    (

    Cứu với

  5. #5
    Tham gia
    29-02-2004
    Bài viết
    3,942
    Like
    0
    Thanked 12 Times in 11 Posts
    Cấu hình này tớ chạy 2 cái forum VBB 4.0 gần 100k pageviews/1 ngày, cũng VPS trên nên core i7, 512MB RAM nhưng mà không có bị lock CPU :| Tớ cũng chẳng hiểu sao với cấu hình của bạn mà mysql chạy nhiều process đến vậy.

    [mysqld]
    port = 3306
    socket = /var/lib/mysql/mysql.sock
    skip-locking
    key_buffer = 64M
    max_allowed_packet = 64M
    table_cache = 600
    sort_buffer_size = 64M
    read_buffer_size = 64M
    read_rnd_buffer_size = 32M
    net_buffer_length = 24M
    thread_stack = 32M
    skip-bdb
    skip-innodb

    [mysqldump]

    quick
    max_allowed_packet = 32M

    [mysql]

    no-auto-rehash
    #safe-updates

    [isamchk]

    key_buffer = 64M
    sort_buffer_size = 24M

    [myisamchk]
    sort_buffer_size = 24M
    read_buffer = 24M
    [mysqlhotcopy]
    interactive-timeout

  6. #6
    Tham gia
    21-04-2009
    Bài viết
    238
    Like
    0
    Thanked 0 Times in 0 Posts
    Oẹp, thế làm thế nào bây giờ? Chẳng hiểu do cái gì gây ra nữa . cái my.cnf là tôi đã thay đổi để optimize rồi, chứ trước ko như thế

  7. #7
    Tham gia
    03-02-2010
    Bài viết
    569
    Like
    56
    Thanked 93 Times in 65 Posts
    Hỏi HP xem có cho ai mượn VPS của bồ để chạy hay không, có thời gian mình cũng dính ,DC hồi đó mình xài là ODS.VN còn HP thì xin mạn phép không nói.
    Site chỉ open tầm 15 phút là ngốn hết CPU và 90% RAM - cache 1/2 lượng RAM.
    Một điều kỳ lạ là VPS chạy rất ngon lành nhưng đột nhiên lại bị như thế, mình cũng nghĩ có thể do mình config chưa đúng, nhưng hóa ra là do HP.

    Cũng có người bị lý do khác và họ build lại serverOS.
    Mã hành vô lực giai nhân sấu, nhân bất phong lưu chỉ vi bần.

    WordPress VietNam

  8. #8
    Tham gia
    21-04-2009
    Bài viết
    238
    Like
    0
    Thanked 0 Times in 0 Posts
    Tức là nhiều khả năng do VPS chứ ko phải do web à đồng chí? Tôi đọc nát trên web, optimize cái my.cnf lại lần nữa rồi, chả hiểu có được ko nữa. Nhìn khắp nơi thấy chú nào dùng lệnh top thì load everage chỉ toàn 0.0x, Cpu(s) toàn 0.0x, đây của tôi load everage hôm qua có lúc lên đến 101, còn CPu(s) TB toàn 30% us, có lúc lên đến 90% us. Mà lạ cái cứ đến tối là nó chậm hoặc chết luôn site, còn ban ngày thì chạy phe phé (

  9. #9
    Tham gia
    03-02-2010
    Bài viết
    569
    Like
    56
    Thanked 93 Times in 65 Posts
    Quote Được gửi bởi nak View Post
    Tức là nhiều khả năng do VPS chứ ko phải do web à đồng chí? Tôi đọc nát trên web, optimize cái my.cnf lại lần nữa rồi, chả hiểu có được ko nữa. Nhìn khắp nơi thấy chú nào dùng lệnh top thì load everage chỉ toàn 0.0x, Cpu(s) toàn 0.0x, đây của tôi load everage hôm qua có lúc lên đến 101, còn CPu(s) TB toàn 30% us, có lúc lên đến 90% us. Mà lạ cái cứ đến tối là nó chậm hoặc chết luôn site, còn ban ngày thì chạy phe phé (
    100% do VPS/OS.
    Bồ kiểm tra xem các thông số có sẵn lúc bồ thuê VPS có hụt đi chút nào không. Ví dụ có thiếu RAM/HDD hay không.
    Mã hành vô lực giai nhân sấu, nhân bất phong lưu chỉ vi bần.

    WordPress VietNam

  10. #10
    Tham gia
    12-12-2007
    Bài viết
    167
    Like
    3
    Thanked 19 Times in 16 Posts
    ý kiến là kiến nghị bên cho thuê vps xem lại nếu vps yếu ("không xứng" so với tiền bạn bỏ ra) thì yêu cầu đổi server khác.

Trang 1 / 6 1234 ... LastLast

Bookmarks

Quy định

  • Bạn không thể tạo chủ đề mới
  • Bạn không thể trả lời bài viết
  • Bạn không thể gửi file đính kèm
  • Bạn không thể sửa bài viết của mình
  •