XF 1.4 A Handful Of Members Getting Logged Out Within 5 Minutes Of Logging In

Divvens

Well-known member
I'm not sure how many of my users face this issue, but up until now around 3 of my users told me that when they log in, they don't stay logged in for more than a minute or 2 (maximum 5 minutes).

I have re-write rules in .htaccess to make sure that there is no switching between www. and non-www.

What I think may be the issue here is storing sessions in cache? I'm using Memcached and have added the following to my config file:
PHP:
$config['cache']['cacheSessions'] = true;

Can that be an issue? I'm on a vps with 1.5 GB dedicated RAM and 1.5 GB VSwap (if maybe the memory is running low to cache sessions properly?)

We have anywhere between 70-85 registered members online (apart from 100's of guests), is sessions cache actually helping me or would I not notice a drop in performance even if I disable sessions cache?
 
For the record: Logging in with 'stay logged in' checked seems to sort out the issue for these users, but I still want to have it solved as others may get annoyed and leave if this keeps happening often.
 
If you have hundreds of guests/bots then you may need to increase the allocated memory.
Where would I possibly do that? Or should I just tell my server guys to edit it (since its managed, I could get it done by them [I think])

I ran mysqltuner and also extracted memory data via SSH, it seems I do (?) have memory sitting free/idle, at least sqltuner says that I have only used 50% maximum, but since that is only calculating MySQL usage of memory, other memory may actually be used and not actually free.

Code:
>>  MySQLTuner 1.4.0 - Major Hayden <major@mhtx.net>
>>  Bug reports, feature requests, and downloads at http://mysqltuner.com/
>>  Run with '--help' for additional options and output filtering
[OK] Currently running supported MySQL version 5.5.42-cll
[OK] Operating on 64-bit architecture

-------- Storage Engine Statistics -------------------------------------------
[--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MRG_MYISAM
[--] Data in MyISAM tables: 1G (Tables: 22)
[--] Data in InnoDB tables: 1G (Tables: 211)
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
[--] Data in MEMORY tables: 4M (Tables: 5)
[!!] Total fragmented tables: 194

-------- Security Recommendations  -------------------------------------------
[OK] All database users have passwords assigned

-------- Performance Metrics -------------------------------------------------
[--] Up for: 20d 22h 26m 6s (64M q [35.597 qps], 5M conn, TX: 753B, RX: 32B)
[--] Reads / Writes: 56% / 44%
[--] Total buffers: 336.0M global + 3.5M per thread (125 max threads)
[OK] Maximum possible memory usage: 773.5M (50% of installed RAM)
[OK] Slow queries: 0% (3K/64M)
[OK] Highest usage of available connections: 29% (37/125)
[OK] Key buffer size / total MyISAM indexes: 64.0M/462.1M
[OK] Key buffer hit rate: 97.8% (196M cached / 4M reads)
[OK] Query cache efficiency: 52.9% (17M cached / 32M selects)
[!!] Query cache prunes per day: 6672
[OK] Sorts requiring temporary tables: 0% (1K temp sorts / 2M sorts)
[!!] Temporary tables created on disk: 89% (237K on disk / 266K total)
[OK] Thread cache hit rate: 99% (42 created / 5M connections)
[!!] Table cache hit rate: 14% (653 open / 4K opened)
[OK] Open file limit used: 0% (126/200K)
[OK] Table locks acquired immediately: 99% (64M immediate / 64M locks)
[!!] InnoDB  buffer pool / data size: 128.0M/1.9G
[OK] InnoDB log waits: 0
-------- Recommendations -----------------------------------------------------
General recommendations:
    Run OPTIMIZE TABLE to defragment tables for better performance
    When making adjustments, make tmp_table_size/max_heap_table_size equal
    Reduce your SELECT DISTINCT queries without LIMIT clauses
    Increase table_open_cache gradually to avoid file descriptor limits
    Read this before increasing table_open_cache over 64: http://bit.ly/1mi7c4C
Variables to adjust:
    query_cache_size (> 64M)
    tmp_table_size (> 64M)
    max_heap_table_size (> 64M)
    table_open_cache (> 100000)
    innodb_buffer_pool_size (>= 1G)

Code:
12:00:01 AM kbmemfree kbmemused  %memused kbbuffers  kbcached  kbcommit   %commi                                    t
12:10:01 AM    116028   1456836     92.62         0    996552         0      0.0                                    0
12:20:01 AM     68592   1504272     95.64         0   1037156         0      0.0                                    0
12:30:02 AM     77736   1495128     95.06         0   1053176         0      0.0                                    0
12:40:01 AM    123712   1449152     92.13         0   1021504         0      0.0                                    0
12:50:01 AM     25144   1547720     98.40         0   1002424         0      0.0                                    0
01:00:01 AM    103320   1469544     93.43         0   1014792         0      0.0                                    0
01:10:01 AM    104112   1468752     93.38         0   1023760         0      0.0                                    0
01:20:01 AM    112536   1460328     92.85         0   1033972         0      0.0                                    0
01:30:01 AM     59432   1513432     96.22         0    985472         0      0.0                                    0
01:40:01 AM    122236   1450628     92.23         0   1004428         0      0.0                                    0
01:50:01 AM     97716   1475148     93.79         0   1002224         0      0.0                                    0
02:00:01 AM    125608   1447256     92.01         0    991440         0      0.0                                    0
02:10:01 AM     32564   1540300     97.93         0   1034252         0      0.0                                    0
02:20:02 AM     39220   1533644     97.51         0   1042156         0      0.0                                    0
02:30:01 AM    136200   1436664     91.34         0   1012628         0      0.0                                    0
02:40:01 AM     73100   1499764     95.35         0   1072780         0      0.0                                    0
02:50:01 AM     24552   1548312     98.44         0    998996         0      0.0                                    0
03:00:01 AM     40012   1532852     97.46         0    996424         0      0.0                                    0
03:10:01 AM     93860   1479004     94.03         0   1008292         0      0.0                                    0
03:20:01 AM     92620   1480244     94.11         0   1027408         0      0.0                                    0
03:30:02 AM    114140   1458724     92.74         0   1016412         0      0.0                                    0
03:40:01 AM    120196   1452668     92.36         0   1010032         0      0.0                                    0

03:40:01 AM kbmemfree kbmemused  %memused kbbuffers  kbcached  kbcommit   %commi                                    t
03:50:01 AM   1013440    559424     35.57         0    146048         0      0.0                                    0
04:00:02 AM    128932   1443932     91.80         0    988728         0      0.0                                    0
04:10:01 AM    326444   1246420     79.25         0    807668         0      0.0                                    0
04:20:01 AM    115492   1457372     92.66         0   1003352         0      0.0                                    0
Average:       134113   1438751     91.47         0    974311         0      0.0                                    0

So I guess I'll have to wait to enable session cache until I add some more memory to my server :P

So my second question:
Would it impact performance majorly for the kind of traffic I get? Approx 275-320 users online most of the time. Can I disable the session cache for now and enable it later when I have more ram? My server loads seem to be fine currently, so in my opinion it should have a noticeable performance hit, but would still like to hear others opinions.

Code:
12:00:01 AM     CPU     %user     %nice   %system   %iowait    %steal     %idle
12:10:01 AM     all     31.10      0.03      3.89      0.01      0.00     64.97
12:20:01 AM     all     30.57      0.03      3.73      0.00      0.00     65.67
12:30:02 AM     all     29.92      0.03      3.69      0.00      0.00     66.36
12:40:01 AM     all     27.06      0.02      3.39      0.09      0.00     69.43
12:50:01 AM     all     27.94      0.05      3.49      0.00      0.00     68.52
01:00:01 AM     all     27.24      0.02      3.45      0.00      0.00     69.28
01:10:01 AM     all     26.74      3.10      3.74      0.22      0.00     66.20
01:20:01 AM     all     30.10      0.03      3.83      0.00      0.00     66.04
01:30:01 AM     all     30.26      0.02      3.83      0.00      0.00     65.88
01:40:01 AM     all     29.68      0.02      3.70      0.00      0.00     66.59
01:50:01 AM     all     35.08      0.05      4.42      1.67      0.00     58.78
02:00:01 AM     all     31.69      0.02      3.95      0.02      0.00     64.32
02:10:01 AM     all     33.58      0.03      4.16      0.00      0.00     62.23
02:20:02 AM     all     37.28      0.03      4.69      0.00      0.00     57.99
02:30:01 AM     all     35.59      0.03      4.42      0.00      0.00     59.95
02:40:01 AM     all     32.94      0.05      4.05      0.00      0.00     62.96
02:50:01 AM     all     34.29      0.02      4.38      0.00      0.00     61.30
03:00:01 AM     all     43.83      0.03      5.41      0.00      0.00     50.73
03:10:01 AM     all     31.86      3.35      4.32      0.09      0.00     60.37
03:20:01 AM     all     35.93      0.02      4.45      0.01      0.00     59.58
03:30:02 AM     all     38.13      0.02      5.07      0.02      0.00     56.75
03:40:01 AM     all     36.98      0.05      4.72      0.00      0.00     58.25
03:50:01 AM     all     38.60      4.60      5.67      0.01      0.00     51.12
04:00:02 AM     all     34.62     15.20      6.24      0.02      0.00     43.92
04:10:01 AM     all     40.81      2.82      7.16      0.18      0.00     49.04
04:20:01 AM     all     35.36      0.02      4.48      0.00      0.00     60.14
Average:        all     33.36      1.14      4.40      0.09      0.00     61.01

Code:
2 Cores in the VPS:
12:00:01 AM   runq-sz  plist-sz   ldavg-1   ldavg-5  ldavg-15
12:10:01 AM         1       227      1.18      1.26      1.31
12:20:01 AM         1       227      1.30      1.58      1.45
12:30:02 AM         2       232      1.43      1.06      1.19
12:40:01 AM         1       226      0.69      0.92      1.12
12:50:01 AM         2       232      1.45      1.07      1.06
01:00:01 AM         4       228      0.57      0.64      0.82
01:10:01 AM         1       228      0.76      1.14      1.05
01:20:01 AM         1       226      0.82      1.08      1.06
01:30:01 AM        10       233      1.88      1.29      1.06
01:40:01 AM         1       226      1.10      1.17      1.11
01:50:01 AM         1       228      1.32      1.17      1.11
02:00:01 AM         3       228      1.70      2.13      1.67
02:10:01 AM        11       233      2.62      1.86      1.67
02:20:02 AM         1       232      1.67      1.43      1.50
02:30:01 AM         1       232      2.07      1.88      1.70
02:40:01 AM         1       228      1.04      1.32      1.49
02:50:01 AM         4       232      1.41      1.18      1.27
03:00:01 AM         1       232      1.22      1.73      1.51
03:10:01 AM         1       230      1.21      1.32      1.41
03:20:01 AM         2       231      1.03      1.03      1.18
03:30:02 AM         2       228      1.78      1.51      1.34
03:40:01 AM         1       228      1.32      1.52      1.42
03:50:01 AM         6       238      3.71      2.57      1.86
04:00:02 AM         8       244      1.16      2.40      2.35
04:10:01 AM         2       230      2.27      2.20      2.20
04:20:01 AM         1       233      1.44      1.55      1.86
Average:            3       230      1.47      1.46      1.41
 
If you have hundreds of guests/bots then you may need to increase the allocated memory.

Otherwise checking "stay logged in" will resolve it.
Just to clarify, I need to increase the total allocated memory to memcached, right? Or a certain specific edit needs to be done in memcached settings?

I'm going to tell my hosts to do it, but I want to be sure of what I'm getting done.
 
You can ignore the above. Thanks for all the assistance as always, @Brogan (or should I say Brotham!)

After increasing the memory allocated to memcached the board is much faster without even performing any tweaks (or enabling sessions cache!). It's raised to 512mb now (allocated memory to memcached).
 
Glad to hear it.

I had the thread open in a tab so I wouldn't forget to respond later.

Currently juggling work/daughter/princess painting (her, not me)/dinner/tidying up/forum/tickets/etc. so would have got to it sometime later tonight :eek:
 
Currently juggling work/daughter/princess painting (her, not me)/dinner/tidying up/forum/tickets/etc. so would have got to it sometime later tonight :eek:
And you do this all while being on fire, right? ;) #Brotham

No worries, my hosts have quite the amazing support team, so they are a pleasure to work with. Will check out if sessions cache fine now :)
 
I'm not sure how many of my users face this issue, but up until now around 3 of my users told me that when they log in, they don't stay logged in for more than a minute or 2 (maximum 5 minutes).

I have re-write rules in .htaccess to make sure that there is no switching between www. and non-www.

What I think may be the issue here is storing sessions in cache? I'm using Memcached and have added the following to my config file:
PHP:
$config['cache']['cacheSessions'] = true;

Can that be an issue? I'm on a vps with 1.5 GB dedicated RAM and 1.5 GB VSwap (if maybe the memory is running low to cache sessions properly?)

We have anywhere between 70-85 registered members online (apart from 100's of guests), is sessions cache actually helping me or would I not notice a drop in performance even if I disable sessions cache?


Can you help me understand how to do the re-write rules in .htaccess?

I have re-write rules in .htaccess to make sure that there is no switching between www. and non-www.
 
Back
Top Bottom