不同用户的执行时间不同

不同用户的执行时间不同

我和另一个受限用户正在运行简单R作业root。执行时间相差很大。问题可能出在哪里?

更多信息

以下是我比较运行时间的方法:

# time /share/binary/R/bin/R CMD BATCH s1n\=50.R

real    0m0.278s
user    0m0.217s
sys 0m0.032s
# su john
$ time /share/binary/R/bin/R CMD BATCH s1n\=50.R

用户下的运行john需要很长时间,而且永远不会完成!perf这些间隔期间的输出是:

   PerfTop:     906 irqs/sec  kernel:19.3%  exact:  0.0% [1000Hz cycles],  (all, 8 CPUs)
-------------------------------------------------------------------------------------------------------------------------------------------------------------

             samples  pcnt function                      DSO
             _______ _____ _____________________________ _______________________________

              598.00 14.5% __GI_vfprintf                 /lib64/libc-2.12.so            
              194.00  4.7% intel_idle                    [kernel.kallsyms]              
              176.00  4.3% read_hpet                     [kernel.kallsyms]              
              170.00  4.1% bcEval                        /usr/local/R/lib64/R/bin/exec/R
              141.00  3.4% ___printf_fp                  /lib64/libc-2.12.so            
              138.00  3.4% __strchrnul                   /lib64/libc-2.12.so            
              121.00  2.9% Rf_cons                       /usr/local/R/lib64/R/bin/exec/R
              120.00  2.9% R_gc_internal                 /usr/local/R/lib64/R/bin/exec/R
               91.00  2.2% _IO_default_xsputn_internal   /lib64/libc-2.12.so            
               88.00  2.1% Rf_allocVector                /usr/local/R/lib64/R/bin/exec/R
               84.00  2.0% _IO_file_xsputn_internal      /lib64/libc-2.12.so            
               82.00  2.0% scientific                    /usr/local/R/lib64/R/bin/exec/R
               72.00  1.7% MatrixSubset                  /usr/local/R/lib64/R/bin/exec/R
               71.00  1.7% duplicate1                    /usr/local/R/lib64/R/bin/exec/R
               68.00  1.7% floor                         /lib64/libm-2.12.so            
               64.00  1.6% __strcmp_sse42                /lib64/libc-2.12.so            
               53.00  1.3% Rf_findVarInFrame3            /usr/local/R/lib64/R/bin/exec/R
               53.00  1.3% Rf_protect                    /usr/local/R/lib64/R/bin/exec/R
               50.00  1.2% _IO_str_init_static_internal  /lib64/libc-2.12.so            
               50.00  1.2% Rf_eval                       /usr/local/R/lib64/R/bin/exec/R
               43.00  1.0% Rf_formatReal                 /usr/local/R/lib64/R/bin/exec/R
               43.00  1.0% Rf_matchArgs                  /usr/local/R/lib64/R/bin/exec/R
               41.00  1.0% _int_malloc                   /lib64/libc-2.12.so            
               36.00  0.9% _itoa_word                    /lib64/libc-2.12.so            
               33.00  0.8% __ieee754_log                 /lib64/libm-2.12.so            
               31.00  0.8% Rf_EncodeReal                 /usr/local/R/lib64/R/bin/exec/R
               29.00  0.7% Rf_mkPROMISE                  /usr/local/R/lib64/R/bin/exec/R
               29.00  0.7% do_bind                       /usr/local/R/lib64/R/bin/exec/R
               28.00  0.7% Rf_install                    /usr/local/R/lib64/R/bin/exec/R
               27.00  0.7% __vsnprintf                   /lib64/libc-2.12.so            
               27.00  0.7% _IO_no_init                   /lib64/libc-2.12.so            
               23.00  0.6% _IO_old_init                  /lib64/libc-2.12.so            
               22.00  0.5% __GI__nss_files_parse_servent /lib64/libnss_files-2.12.so    
               22.00  0.5% Rconn_printf                  /usr/local/R/lib64/R/bin/exec/R
               22.00  0.5% finite                        /lib64/libm-2.12.so            
               22.00  0.5% findVarLocInFrame             /usr/local/R/lib64/R/bin/exec/R
               21.00  0.5% Rf_getAttrib                  /usr/local/R/lib64/R/bin/exec/R

我怀疑ulimit和“磁盘配额. After disabling the disk quota, the problem is still exist. Unfortunately, limits are equal underandjohn . Here is the output ofulimit -a”(感谢@Eric DANNIELOU):

# ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 127383
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 1024
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
# su john
$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 127383
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 1024
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

操作系统:CentOS 6.2

硬件:Intel Core-i7 16GB RAM

先感谢您!

答案1

我不确定它是否相关,但您确实应该使用su - john而不是su john: 这样它将调用一个干净的登录 shell。请检查这样做是否ulimit -a现在可能显示一些相关的差异?

另一件事:使用strace -f R而不是strace R这样当它调用子进程时,strace 也会跟踪该子进程并准确显示该子进程挂起的位置。

相关内容