Thursday, April 1, 2010

Performance Tuning Issues : Recursion in Models

I recently launched my site live and it bogs with only 10 users active.. page load times are minimum 3 seconds and at capacity … upwards 20 seconds I think I know what the problem is.

 

I installed xdebug and have played around with some cache (ACP) stuff.  I found that actually deleting my app/tmp/cache/models entries helped improve performance since there must have been some old stuff in there. 

 

I think the models have too much recursion.  The entire application is user centric and every model has some reference back to the user, and the user has a reference back to it AND MORE.  So I got a new screen and I thnk it’s xdebug’s

 

 

( ! ) Fatal error: Maximum function nesting level of '100' reached, aborting! in C:\xampp\htdocs\cakephp\cake\libs\folder.php on line 239

Call Stack

#

Time

Memory

Function

Location

1

0.0015

87144

{main}( )

..\index.php:0

2

0.2187

3539376

Dispatcher->dispatch( )

..\index.php:88

3

0.2656

3939992

Dispatcher->_invoke( )

..\dispatcher.php:194

4

0.2656

3941320

Controller->constructClasses( )

..\dispatcher.php:207

5

0.5621

9422760

Controller->loadModel( )

..\controller.php:455

6

0.5622

9424448

ClassRegistry->init( )

..\controller.php:510

7

0.5636

9464000

Model->__construct( )

..\class_registry.php:140

8

0.5847

9500824

Model->__createLinks( )

..\model.php:447

9

0.6094

9540520

Model->__constructLinkedModel( )

..\model.php:638

10

0.6094

9541176

ClassRegistry->init( )

..\model.php:666

11

0.6094

9574296

Model->__construct( )

..\class_registry.php:140

12

0.6250

9614480

Model->__createLinks( )

..\model.php:447

13

0.6562

9701072

Model->__constructLinkedModel( )

..\model.php:638

14

0.6562

9701728

ClassRegistry->init( )

..\model.php:666

15

0.6562

9731032

Model->__construct( )

..\class_registry.php:140

16

0.6719

9751248

Model->__createLinks( )

..\model.php:447

17

0.6719

9753248

Model->__constructLinkedModel( )

..\model.php:638

18

0.6719

9753904

ClassRegistry->init( )

..\model.php:666

19

0.6875

9806448

Model->__construct( )

..\class_registry.php:140

20

0.7031

9845288

Model->__createLinks( )

..\model.php:447

21

0.7031

9847288

Model->__constructLinkedModel( )

..\model.php:638

22

0.7031

9847944

ClassRegistry->init( )

..\model.php:666

23

0.7031

10083720

Model->__construct( )

..\class_registry.php:140

24

0.7344

10201992

Model->__createLinks( )

..\model.php:447

25

0.8624

10372984

Model->__constructLinkedModel( )

..\model.php:638

26

0.8624

10373640

ClassRegistry->init( )

..\model.php:666

27

0.8641

10431704

Model->__construct( )

..\class_registry.php:140

28

0.8437

10457744

Model->__createLinks( )

..\model.php:447

29

0.8437

10459744

Model->__constructLinkedModel( )

..\model.php:638

30

0.8437

10460400

ClassRegistry->init( )

..\model.php:666

31

0.8437

10512440

Model->__construct( )

..\class_registry.php:140

32

0.8750

10551800

Model->__createLinks( )

..\model.php:447

33

0.8750

10553800

Model->__constructLinkedModel( )

..\model.php:638

34

0.8750

10554456

ClassRegistry->init( )

..\model.php:666

35

0.8750

10587344

Model->__construct( )

..\class_registry.php:140

36

0.8906

10629800

Model->__createLinks( )

..\model.php:447

37

0.8906

10631800

Model->__constructLinkedModel( )

..\model.php:638

38

0.8906

10632456

ClassRegistry->init( )

..\model.php:666

39

0.8906

10662400

Model->__construct( )

..\class_registry.php:140

40

0.9219

10701536

Model->__createLinks( )

..\model.php:447

41

0.9219

10703536

Model->__constructLinkedModel( )

..\model.php:638

42

0.9219

10704192

ClassRegistry->init( )

..\model.php:666

43

0.9219

10771696

Model->__construct( )

..\class_registry.php:140

44

0.9375

10815424

Model->__createLinks( )

..\model.php:447

45

0.9375

10817424

Model->__constructLinkedModel( )

..\model.php:638

46

0.9375

10818080

ClassRegistry->init( )

..\model.php:666

47

0.9375

10820872

Model->__construct( )

..\class_registry.php:140

48

0.9375

10845648

Model->__createLinks( )

..\model.php:447

49

1.6187

12276312

Model->__constructLinkedModel( )

..\model.php:638

50

1.6187

12276968

ClassRegistry->init( )

..\model.php:666

51

1.6201

12314640

Model->__construct( )

..\class_registry.php:140

52

1.6094

12349712

Model->__createLinks( )

..\model.php:447

53

1.6094

12351712

Model->__constructLinkedModel( )

..\model.php:638

54

1.6094

12352368

ClassRegistry->init( )

..\model.php:666

55

1.6094

12354832

Model->__construct( )

..\class_registry.php:140

56

1.6094

12369496

Model->__createLinks( )

..\model.php:447

57

1.9687

13028544

Model->__constructLinkedModel( )

..\model.php:638

58

1.9687

13029200

ClassRegistry->init( )

..\model.php:666

59

1.9687

13167968

Model->__construct( )

..\class_registry.php:140

60

1.9844

13208152

Model->__createLinks( )

..\model.php:447

61

1.9844

13210152

Model->__constructLinkedModel( )

..\model.php:638

62

1.9844

13210808

ClassRegistry->init( )

..\model.php:666

63

1.9844

13279984

Model->__construct( )

..\class_registry.php:140

64

2.0056

13346880

Model->__createLinks( )

..\model.php:447

65

2.0937

13590944

Model->__constructLinkedModel( )

..\model.php:638

66

2.0937

13591600

ClassRegistry->init( )

..\model.php:666

67

2.0937

13593984

Model->__construct( )

..\class_registry.php:140

68

2.0937

13600160

Model->__createLinks( )

..\model.php:447

69

2.0937

13602160

Model->__constructLinkedModel( )

..\model.php:638

70

2.0937

13602816

ClassRegistry->init( )

..\model.php:666

71

2.0937

13605456

Model->__construct( )

..\class_registry.php:140

72

2.1094

13621488

Model->__createLinks( )

..\model.php:447

73

2.1426

13660648

Model->__constructLinkedModel( )

..\model.php:638

74

2.1426

13661304

ClassRegistry->init( )

..\model.php:666

75

2.1427

13663768

Model->__construct( )

..\class_registry.php:140

76

2.1439

13673376

Model->__createLinks( )

..\model.php:447

77

2.1562

13821696

Model->__constructLinkedModel( )

..\model.php:638

78

2.1562

13822352

ClassRegistry->init( )

..\model.php:666

79

2.1719

13851704

Model->__construct( )

..\class_registry.php:140

80

2.2201

13881864

Model->__createLinks( )

..\model.php:447

81

2.2204

13883864

Model->__constructLinkedModel( )

..\model.php:638

82

2.2204

13884520

ClassRegistry->init( )

..\model.php:666

83

2.2205

13887176

Model->__construct( )

..\class_registry.php:140

84

2.1875

13912032

Model->__createLinks( )

..\model.php:447

85

2.2031

13926968

Model->__constructLinkedModel( )

..\model.php:638

86

2.2031

13927624

ClassRegistry->init( )

..\model.php:666

87

2.2031

13997560

Model->__construct( )

..\class_registry.php:140

88

2.2031

14022728

Model->setSource( )

..\model.php:439

89

2.2031

14033152

Model->schema( )

..\model.php:785

90

2.2031

14033992

DboMysqlBase->describe( )

..\model.php:930

91

2.2031

14035536

DataSource->describe( )

..\dbo_mysql.php:95

92

2.2031

14035928

DataSource->__cacheDescription( )

..\datasource.php:248

93

2.2031

14036392

Cache->read( )

..\datasource.php:415

94

2.2031

14038320

FileEngine->read( )

..\cache.php:293

95

2.2031

14039456

FileEngine->__setKey( )

..\file.php:160

96

2.2031

14040064

Folder->inPath( )

..\file.php:249

97

2.2031

14040552

Folder->slashTerm( )

..\folder.php:326

98

2.2031

14040552

Folder->correctSlashFor( )

..\folder.php:293

99

2.2031

14040552

Folder->isWindowsPath( )

..\folder.php:276

 

 

I hope this comes out okay in the email.. but this sums it up…

 

Does anyone know of how to limit any of these functions? Do I need to re engineer my models???

 

Thanks.. .Alan

No comments: