Discover Centmin Mod today
Register Now

Nginx Should I create swap for server

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by reallove0810, Jan 4, 2015.

  1. reallove0810

    reallove0810 New Member

    22
    10
    3
    Jan 3, 2015
    Ratings:
    +11
    Local Time:
    5:48 PM
    1.7.9
    5.5.41
    Currently, my memory parameter like the following. Shoud I create 1GB swap file? (SSD Drive)
    Code:
    [root@vps php.d]# free -m
                    total       used       free     shared    buffers     cached
    Mem:           498        314        184         65         16        104
    -/+ buffers/cache:        193        305

     
  2. eva2000

    eva2000 Administrator Staff Member

    31,027
    6,928
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,434
    Local Time:
    2:48 AM
    Nginx 1.13.x
    MariaDB 5.5
    Yup swap is always recommended. I like to have swap space twice size of memory installed for <2GB memory servers
     
  3. elargento

    elargento Member

    293
    16
    18
    Jan 4, 2016
    Ratings:
    +39
    Local Time:
    1:48 PM
    10
    and for >2GB dedicated servers and vps?
     
    Last edited: May 10, 2017
  4. eva2000

    eva2000 Administrator Staff Member

    31,027
    6,928
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,434
    Local Time:
    2:48 AM
    Nginx 1.13.x
    MariaDB 5.5
    use whatever your web app and server usage requires
     
  5. elargento

    elargento Member

    293
    16
    18
    Jan 4, 2016
    Ratings:
    +39
    Local Time:
    1:48 PM
    10
    There are no swap requirements for Wordpress
     
  6. eva2000

    eva2000 Administrator Staff Member

    31,027
    6,928
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,434
    Local Time:
    2:48 AM
    Nginx 1.13.x
    MariaDB 5.5
    you have to measure the requirements yourself for your specific web app's usage
     
  7. elargento

    elargento Member

    293
    16
    18
    Jan 4, 2016
    Ratings:
    +39
    Local Time:
    1:48 PM
    10
    Sorry, my question was wrong. Swap should be twice the memory because there are many posibilities memory will get full. In case memory is 16gb and app usually uses 8gb there is no reason to set >2gb as swap since memory usage is usually around 50%.

    Are my thoughts correct?
     
  8. eva2000

    eva2000 Administrator Staff Member

    31,027
    6,928
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,434
    Local Time:
    2:48 AM
    Nginx 1.13.x
    MariaDB 5.5
    There's no one correct formula, it's down to how your server will be utilised and for what web app and/or server tasks.