首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >opencart电子商务网站的第一字节时间是巨大的

opencart电子商务网站的第一字节时间是巨大的
EN

Stack Overflow用户
提问于 2014-08-30 12:30:25
回答 1查看 1.2K关注 0票数 0

我在http://www.webpagetest.org/上查看了电子商务网站的网站统计数据:它给出了以下报告

代码语言:javascript
复制
Document Complete   Fully Loaded
Load Time   First Byte  Start Render    Speed Index DOM Elements    Time    Requests    Bytes In        Time    Requests    Bytes In
First View  20.995s 15.718s 16.492s 19760   1177    20.995s 117 2,357 KB    22.904s 161 2,827 KB
Repeat View 9.804s  8.200s  8.623s  9596    1177    9.804s  10  351 KB  11.276s 37  476 KB

我使用top命令检查了我的服务器&检查mysql占用了99%的CPU%时间,在TIME+中占用了214:26.79。

以前,mysql表没有被优化,所以我创建了这些表的索引。之后,加载时间大大缩短。现在我正面临着第一次拜特时代的问题。以下是mysql变量:

代码语言:javascript
复制
mysql> show variables like 'innodb_buffer_pool_size';
+-------------------------+-----------+
| Variable_name           | Value     |
+-------------------------+-----------+
| innodb_buffer_pool_size | 134217728 |
+-------------------------+-----------+
1 row in set (0.00 sec)

mysql> show variables like 'innodb_flush_log_at_trx_commit';
+--------------------------------+-------+
| Variable_name                  | Value |
+--------------------------------+-------+
| innodb_flush_log_at_trx_commit | 1     |
+--------------------------------+-------+
1 row in set (0.00 sec)

mysql> show variables like 'innodb_open_files';
+-------------------+-------+
| Variable_name     | Value |
+-------------------+-------+
| innodb_open_files | 300   |
+-------------------+-------+
1 row in set (0.00 sec)

mysql> show variables like 'innodb_table_locks';
+--------------------+-------+
| Variable_name      | Value |
+--------------------+-------+
| innodb_table_locks | ON    |
+--------------------+-------+
1 row in set (0.00 sec)

mysql> show variables like 'innodb_thread_concurrency';
+---------------------------+-------+
| Variable_name             | Value |
+---------------------------+-------+
| innodb_thread_concurrency | 0     |
+---------------------------+-------+
1 row in set (0.00 sec)

mysql> show variables like 'join_buffer_size';
+------------------+--------+
| Variable_name    | Value  |
+------------------+--------+
| join_buffer_size | 131072 |
+------------------+--------+
1 row in set (0.00 sec)

mysql> show variables like 'key_buffer_size';
+-----------------+----------+
| Variable_name   | Value    |
+-----------------+----------+
| key_buffer_size | 16777216 |
+-----------------+----------+
1 row in set (0.00 sec)

mysql> show variables like 'max_connections';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| max_connections | 151   |
+-----------------+-------+
1 row in set (0.00 sec)

mysql> show variables like 'max_delayed_threads';
+---------------------+-------+
| Variable_name       | Value |
+---------------------+-------+
| max_delayed_threads | 20    |
+---------------------+-------+
1 row in set (0.00 sec)

mysql> show variables like 'max_heap_table_size';
+---------------------+----------+
| Variable_name       | Value    |
+---------------------+----------+
| max_heap_table_size | 16777216 |
+---------------------+----------+
1 row in set (0.00 sec)

mysql> show variables like 'max_tmp_tables';
+----------------+-------+
| Variable_name  | Value |
+----------------+-------+
| max_tmp_tables | 32    |
+----------------+-------+
1 row in set (0.01 sec)

mysql> show variables like 'thread_cache_size';
+-------------------+-------+
| Variable_name     | Value |
+-------------------+-------+
| thread_cache_size | 8     |
+-------------------+-------+
1 row in set (0.00 sec)

mysql> show variables like 'tmp_table_size';
+----------------+----------+
| Variable_name  | Value    |
+----------------+----------+
| tmp_table_size | 16777216 |
+----------------+----------+
1 row in set (0.00 sec)

mysql> show variables like 'wait_timeout';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| wait_timeout  | 28800 |
+---------------+-------+
1 row in set (0.00 sec)

mysql> show variables like 'myisam_sort_buffer_size';
+-------------------------+---------+
| Variable_name           | Value   |
+-------------------------+---------+
| myisam_sort_buffer_size | 8388608 |
+-------------------------+---------+
1 row in set (0.00 sec)

我认为第一个字节延迟主要是由于mysql配置或opencart框架,我已经采取了一些步骤来优化运行站点的nginx。如何减少第一个字节的时间?请帮帮忙。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-09-05 08:53:15

我解决了这个问题。问题在于opencart数据库索引系统。因为它们没有正确地索引表--一些与product_tags & url_alias相关的查询过去需要很长时间才能执行。由于它们锁定了这些表,因此sequence.Creating中的其他查询无法访问它们--对于在客户端接收到的第一个字节来说,这是相当大的延迟。

解决方案是为所有这些表创建索引,这些表的查询时间相当长。我的延迟时间已经减少到了原来的十分之一。(FOr进一步的信息和细节,查看opencart论坛-这是OC用户非常常见的问题)

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25582379

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档