开发者社区> 问答> 正文

服务器同时访问ip不到1000,就占满了cpu和内存

服务器配置:
CPU: 1核    内存: 2048 MB
2Mbps
CentOS 6.5 64位
Apache2.4
Mysql:5.6




最近网站经常出现数据库链接不上,特别是晚上,很郁闷,晚上又不知道,每次都是第二天才知道然后重启服务器,网站才能访问。
看后台又没有人攻击,也扫描木马什么的,也没有。
然后用软件看,cpu老是异常。
就测试了下,1000ip不到访问一个页面,就瞬间让整个服务器的cpu爆满,内存也站了1.3-1.5G左右。
其中数据库就占用30-50%左右。


不知道是数据库有问题还是什么?


平时正常情况下服务器cpu占用还不到5%,数据库占用cpu更少了。


就是并发一多,数据库就挂了。



我把之前的数据库错误日志删了,之前的太多了,也不数据数据库这块。
刚才我自己用代理ip访问网站,然后网站就打不开,数据库停止运行了。
下面是我刚才测试得到的数据库日志,还望各位帮忙看看。

161002 15:31:43 mysqld_safe Number of processes running now: 0
161002 15:31:43 mysqld_safe mysqld restarted
2016-10-02 15:31:44 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-10-02 15:31:45 14693 [Note] Plugin 'FEDERATED' is disabled.
2016-10-02 15:31:45 14693 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-10-02 15:31:45 14693 [Note] InnoDB: The InnoDB memory heap is disabled
2016-10-02 15:31:45 14693 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-10-02 15:31:45 14693 [Note] InnoDB: Memory barrier is not used
2016-10-02 15:31:45 14693 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-10-02 15:31:45 14693 [Note] InnoDB: Using Linux native AIO
2016-10-02 15:31:45 14693 [Note] InnoDB: Using CPU crc32 instructions
2016-10-02 15:31:45 14693 [Note] InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
2016-10-02 15:31:45 14693 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2016-10-02 15:31:45 14693 [ERROR] Plugin 'InnoDB' init function returned error.
2016-10-02 15:31:45 14693 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2016-10-02 15:31:45 14693 [ERROR] Unknown/unsupported storage engine: InnoDB
2016-10-02 15:31:45 14693 [ERROR] Aborting

2016-10-02 15:31:45 14693 [Note] Binlog end
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'partition'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'BLACKHOLE'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'INNODB_METRICS'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'INNODB_CMPMEM'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'INNODB_CMP'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'INNODB_LOCKS'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'INNODB_TRX'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'ARCHIVE'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'MyISAM'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'CSV'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'MRG_MYISAM'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'MEMORY'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'sha256_password'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'mysql_old_password'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'mysql_native_password'
2016-10-02 15:31:45 14693 [Note] Shutting down plugin 'binlog'
2016-10-02 15:31:45 14693 [Note] /alidata/server/mysql/bin/mysqld: Shutdown complete

161002 15:31:45 mysqld_safe mysqld from pid file /alidata/server/mysql/data/AY140716132949Z.pid ended


展开
收起
cnnanny 2016-10-02 00:52:44 7003 0
3 条回答
写回答
取消 提交回答
  • 回 2楼云代维的帖子
    我上传了数据库错误日志,您看看
    2016-10-02 15:37:25
    赞同 展开评论 打赏
  • 你看到的IP,是访问量统计里使用浏览器访问的,还有很多访问是统计不到的,比如蜘蛛,攻击,采集,扫描。
    2016-10-02 14:23:08
    赞同 展开评论 打赏
  • 旺旺:nectar2。
    您好,

    抱歉给您带来不便。

    或许您可以再具体查看一下日志,看看mysql的什么操作占用了这么多的资源。

    如果事情是发生在半夜,可以留意一下是否由于搜索引擎的蜘蛛自动批量访问站点导致的。
    2016-10-02 08:38:28
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
内存取证与IaaS云平台恶意行 为的安全监控 立即下载
RDS SQL Server CPU高使用率性能优化 立即下载
云服务器ECS内存增强型实例re6全新发布 立即下载