SSD 突然变得非常慢(慢 50 倍)

SSD 突然变得非常慢(慢 50 倍)

我在 Ubuntu 12.04 服务器上使用 SSD 存储大约 460GB 的数据。(该驱动器可容纳 560GB,因此大约已占用 88%。)我有一个程序,它会对数据进行大量随机访问(不写入),我上次运行该程序(正常)是在几天前。当我昨天运行它时,它突然比以前慢了很多。该程序只是对驱动器进行随机访问。

以前我每秒可以进行大约 5000 次随机查找;现在我只能进行大约 100 次。这比对 HDD 进行随机访问要慢。(去年我对一些问题进行了基准测试。)

我最近唯一做的事情就是安装 gcc 4.7 并升级所有软件包。但是,我尝试使用 clang 编译所有内容,但没有发现任何差异。

驱动器的格式为,ext4唯一的选项是errors=remount-ro。我尝试重新启动机器并修剪设备,但并没有改变任何事情。分析代码显示它将所有时间都花在了openclosemmap调用上。(请注意,我没有直接调用 mmap —— 我使用的是 all C-stylefopen fseekfread调用。)

知道是什么原因造成的吗?如果有可能的话,我可以重新格式化驱动器。

编辑:以下是 2TB HDD 和 500GB SSD 的一些基准数据

sudo hdparm -Tt /dev/sdb1

/dev/sdb1:
 Timing cached reads:   6814 MB in  2.00 seconds = 3410.05 MB/sec
 Timing buffered disk reads: 458 MB in  3.00 seconds = 152.45 MB/sec

sudo hdparm -Tt /dev/sdc1

/dev/sdc1:
 Timing cached reads:   6890 MB in  2.00 seconds = 3447.93 MB/sec
 Timing buffered disk reads: 780 MB in  3.01 seconds = 259.36 MB/sec

以下是 的输出smartctl

=== START OF INFORMATION SECTION ===
Model Family:     Intel 320 Series SSDs
Device Model:     INTEL SSDSA2CW600G3
Serial Number:    CVPR140004B7600FGN
LU WWN Device Id: 5 001517 9596df196
Firmware Version: 4PC10362
User Capacity:    600,127,266,816 bytes [600 GB]
Sector Size:      512 bytes logical/physical
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   8
ATA Standard is:  ATA-8-ACS revision 4
Local Time is:    Sun Jan 26 16:46:53 2014 MST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x00) Offline data collection activity
                    was never started.
                    Auto Offline Data Collection: Disabled.
Self-test execution status:      (   0) The previous self-test routine completed
                    without error or no self-test has ever 
                    been run.
Total time to complete Offline 
data collection:        (    1) seconds.
Offline data collection
capabilities:            (0x75) SMART execute Offline immediate.
                    No Auto Offline data collection support.
                    Abort Offline collection upon new
                    command.
                    No Offline surface scan supported.
                    Self-test supported.
                    Conveyance Self-test supported.
                    Selective Self-test supported.
SMART capabilities:            (0x0003) Saves SMART data before entering
                    power-saving mode.
                    Supports SMART auto save timer.
Error logging capability:        (0x01) Error logging supported.
                    General Purpose Logging supported.
Short self-test routine 
recommended polling time:    (   1) minutes.
Extended self-test routine
recommended polling time:    (   1) minutes.
Conveyance self-test routine
recommended polling time:    (   1) minutes.
SCT capabilities:          (0x003d) SCT Status supported.
                    SCT Error Recovery Control supported.
                    SCT Feature Control supported.
                    SCT Data Table supported.

SMART Attributes Data Structure revision number: 5
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  3 Spin_Up_Time            0x0020   100   100   000    Old_age   Offline      -       0
  4 Start_Stop_Count        0x0030   100   100   000    Old_age   Offline      -       0
  5 Reallocated_Sector_Ct   0x0032   100   100   000    Old_age   Always       -       0
  9 Power_On_Hours          0x0032   100   100   000    Old_age   Always       -       17833
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       13
170 Reserve_Block_Count     0x0033   100   100   010    Pre-fail  Always       -       0
171 Program_Fail_Count      0x0032   100   100   000    Old_age   Always       -       0
172 Erase_Fail_Count        0x0032   100   100   000    Old_age   Always       -       0
183 Runtime_Bad_Block       0x0030   100   100   000    Old_age   Offline      -       0
184 End-to-End_Error        0x0032   100   100   090    Old_age   Always       -       0
187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -       0
192 Unsafe_Shutdown_Count   0x0032   100   100   000    Old_age   Always       -       5
199 UDMA_CRC_Error_Count    0x0030   100   100   000    Old_age   Offline      -       0
225 Host_Writes_32MiB       0x0032   100   100   000    Old_age   Always       -       3236658
226 Workld_Media_Wear_Indic 0x0032   100   100   000    Old_age   Always       -       4973
227 Workld_Host_Reads_Perc  0x0032   100   100   000    Old_age   Always       -       65
228 Workload_Minutes        0x0032   100   100   000    Old_age   Always       -       1067143
232 Available_Reservd_Space 0x0033   100   100   010    Pre-fail  Always       -       0
233 Media_Wearout_Indicator 0x0032   096   096   000    Old_age   Always       -       0
241 Host_Writes_32MiB       0x0032   100   100   000    Old_age   Always       -       3236658
242 Host_Reads_32MiB        0x0032   100   100   000    Old_age   Always       -       6437718

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
No self-tests have been logged.  [To run self-tests, use: smartctl -t]


Note: selective self-test log revision number (0) not 1 implies that no selective self-test has ever been run
SMART Selective self-test log data structure revision number 0
Note: revision number not 1 implies that no selective self-test has ever been run
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

[编辑:我正在后台继续处理这个问题。当我解决这个问题后,我会在这里发布一些内容。]

答案1

所以,最终的答案有点令人尴尬,因为我本应该能够找到答案,但我找错了地方。关键线索在于硬盘速度的问题——测试表明硬盘速度也变慢了。

处理读取磁盘数据的类的内部缓冲区具有默认读取大小。进行随机访问时,该大小应该相对较小,因为您以后不会使用任何缓冲数据。当按顺序对整个文件执行操作时,较大的值可提供更好的性能,因为您将重复使用数据。鉴于这是一段共享代码中的常量,使用该代码对一个应用程序进行调整实际上会破坏对随机访问的调整,从而导致我所经历的严重减速。

相关内容