Масштабирование чего?
Для мониторинга есть средства как со стороны ОС, так и в самом python.
Что-то мне подсказывает, что просто запущенный бот вряд-ли будет работать медленнее, чем тот-же бот завернутый во Flask.
Совсем странное утверждение. Смотрел несколько примеров ботов завернутый в http - это-же ужас какой-то. Они сильно перегружены и захламлены в плане кода. Что-бы добавить какой-то 1 элемент нужно пол кода перерыть. Не совсем похоже на "ускоренное решение проблем".
select *,
IF(t1.isGuest=1,@c:=@c+1,0) as rate1,
IF(t1.isGuest=0,@d:=@d+1,0) as rate2,
@b:=@b+1 as rate
FROM (
select
temp.userId as userId,
SUM(CASE WHEN temp.resultGame IS NOT NULL THEN 1 ELSE 0 END) as allGame,
SUM(CASE WHEN temp.resultGame = 3 THEN 1 ELSE 0 END) as winGame,
SUM(CASE WHEN temp.resultGame in(2,4,5,6) THEN 1 ELSE 0 END) as drawGame,
SUM(CASE WHEN temp.resultGame = 1 THEN 1 ELSE 0 END) as loseGame,
SUM(CASE WHEN temp.resultGame = 0 THEN 1 ELSE 0 END) as startGame,
SUM(CASE WHEN temp.resultGame=3 AND UNIX_TIMESTAMP(temp.timeStart)>=UNIX_TIMESTAMP(CURDATE()) THEN 1 ELSE 0 END) as countNewWinGame,
SUM(CASE WHEN temp.resultGame in(2,4,5,6) AND UNIX_TIMESTAMP(temp.timeStart)>=UNIX_TIMESTAMP(CURDATE()) THEN 1 ELSE 0 END) as countNewDrawGame,
SUM(CASE WHEN UNIX_TIMESTAMP(temp.timeStart)>=UNIX_TIMESTAMP(CURDATE()) AND temp.numberMove>3 THEN 1 ELSE 0 END) as countNewAllGame,
SUM(temp.timeUser+temp.timeUI) as sumTimeGame,
MAX(t1.isGuest) isGuest,
IF(UNIX_TIMESTAMP()-MAX(v3.lastBeacon)<=120,1,0) as online,
IF(UNIX_TIMESTAMP()-MAX(v3.lastActivity)<=300,1,0) as onlineActive
from chess_historyui temp
LEFT JOIN `user_activity` v3 ON v3.userId=temp.userId and v3.gameVariationId=3
INNER JOIN `kosynka_users` t1 ON t1.userId=temp.userId
LEFT JOIN `user_games` t2 ON (t2.userId=temp.userId AND t2.gameVariationId=3)
GROUP BY temp.userId
ORDER BY winGame DESC,drawGame DESC, allGame DESC, userId DESC
) t1
JOIN (SELECT @b:=0, @c:=0, @d:=0) t_var ON 1=1
select
temp.userId as userId,
SUM(CASE WHEN temp.resultGame IS NOT NULL THEN 1 ELSE 0 END) as allGame,
SUM(CASE WHEN temp.resultGame = 3 THEN 1 ELSE 0 END) as winGame,
SUM(CASE WHEN temp.resultGame in(2,4,5,6) THEN 1 ELSE 0 END) as drawGame,
SUM(CASE WHEN temp.resultGame = 1 THEN 1 ELSE 0 END) as loseGame,
SUM(CASE WHEN temp.resultGame = 0 THEN 1 ELSE 0 END) as startGame,
SUM(CASE WHEN temp.resultGame=3 AND UNIX_TIMESTAMP(temp.timeStart)>=UNIX_TIMESTAMP(CURDATE()) THEN 1 ELSE 0 END) as countNewWinGame,
SUM(CASE WHEN temp.resultGame in(2,4,5,6) AND UNIX_TIMESTAMP(temp.timeStart)>=UNIX_TIMESTAMP(CURDATE()) THEN 1 ELSE 0 END) as countNewDrawGame,
SUM(CASE WHEN UNIX_TIMESTAMP(temp.timeStart)>=UNIX_TIMESTAMP(CURDATE()) AND temp.numberMove>3 THEN 1 ELSE 0 END) as countNewAllGame,
SUM(temp.timeUser+temp.timeUI) as sumTimeGame,
IF(UNIX_TIMESTAMP()-MAX(v3.lastBeacon)<=120,1,0) as online,
IF(UNIX_TIMESTAMP()-MAX(v3.lastActivity)<=300,1,0) as onlineActive,
IF(t1.isGuest=1,@c:=@c+1,0) as rate1,
IF(t1.isGuest=0,@d:=@d+1,0) as rate2,
@b:=@b+1 as rate
from chess_historyui temp
LEFT JOIN `user_activity` v3 ON v3.userId=temp.userId and v3.gameVariationId=3
INNER JOIN `kosynka_users` t1 ON t1.userId=temp.userId
LEFT JOIN `user_games` t2 ON (t2.userId=temp.userId AND t2.gameVariationId=3)
JOIN (SELECT @b:=0, @c:=0, @d:=0) t_var ON 1=1
GROUP BY temp.userId
Я, кстати, думал, что указание второй и далее сортировки выполняется в том случае, когда в первой появляются одинаковые значения.
Я ошибаюсь?