I. Memory dumps
1). Global Area
ALTER session SET EVENTS ' immediate trace name Global_area level n ';
1 contains PGA
2 contains SGA
4 contains UGA
8 contains indrect memory
2). Library CacheALTER session SET EVENTS ' immediate trace name Library_cache level n ';
1 Library Cache statistic Information
2 contains hash table histogram
3 contains object handle
4 contains object structure (Heap 0)
3). Row Cache
ALTER session SET EVENTS ' immediate tra
illustration:
The "Transshipment (factory)/in Transfer (plant)" Inventory for Materials Z303305 is 100 (in-transit inventory formed by MB1B Mobile Type 303 dumps)
the "interim plant/in Transfer (plant)" Inventory of material Z313315 (transfer between different location of the same factory) is 0
Inventory of "in-transit inventory/stock in Transit" for material ZSTO1 100
From this, we can conclude that the stock in transit (factory) in the factory
performance analysis and tuning.
Background knowledge
Main methods of performance analysis
Monitoring: Monitoring is a common way to view the run-time behavior of an application. There are often multiple views (view) that display CPU usage, memory usage, thread state, and other useful information in real time, so that users can quickly discover the key to the problem.
Dump: The profiling tool obtains current state data from memory and stores it in a file for static profiling. A Java program
{}
Dict
[]
List
"String"
Str
1234.56
int or float
True/false
True/false
Null
None
Python's built-in json modules provide a very sophisticated translation of Python objects into JSON format. Let's look at how to turn the Python object into a JSON:Import JSON>>> d = dict (name='Bob', age=20, score=88)>>> Json.dumps (d) ' {"Age": +, "score": "," "Name": "Bob"} '
Python json serialization deserialization and Chinese Encoding
In a project, you need to obtain a json-format data from the cloud, save it to a local file, and then read it out. In this case, you need to use the json dumps method and loads method, to achieve data serialization and deserialization. Specifically, the dumps method can set the data sequence in json format to the related data type of python, whi
read out to form an object. How do---serialize?Two modules are available in Python for serialization. Are pickle and JSON, respectively.PicklePickle is a unique serialization module in Python, so-called exclusive, which means that it cannot interact with the serialization of other programming languages because pickle converts the data object to bytesImport Pickle>>> d=[1,2,3,4]>>> pickle.dumps (d) b'\x80\x03]q\ X00 (k\x01k\x02k\x03k\x04e. '>>> type (pickle.dumps (d))class'bytes' > #类型为byte
, we use python, python has a modifier for functions.
So the implementation scheme is as follows:
Define a decorator. If the data is obtained before, the data in the cache is directly obtained. If the data is not obtained before, the data is pulled from the website and saved to the cache.
The Code is as follows:Copy codeThe Code is as follows:Def get_dump_data (dir_name, url ):M = hashlib. md5 (url)Filename = m. hexdigest ()Full_file_name = \ 'dumps/%
JSON Advanced
Python's Dict object can be serialized directly into the JSON {}, but, many times, we prefer to use class to represent objects, such as defining the student class, and then serializing:
Import Jsonclass Student (object): def __init__ (self, name, age, score): self.name = name self.age = Age Self.score = scores = Student (' Bob ', ', ') print (Json.dumps (s))
Run the code and relentlessly get a typeerror:
Traceback (most recent): ... TypeError:
The reason for the error
obtained data and retrieve it directly from the cache when necessary.
OK. the target already exists. how can this problem be achieved?
If it is in C ++, this is a very troublesome thing, and the code written must be ugly, but fortunately, we use python, python has a modifier for functions.
So the implementation scheme is as follows:
Define a decorator. if the data is obtained before, the data in the cache is directly obtained. if the data is not obtained before, the data is pulled from the webs
expiration, and more.Here's the official Bench-mark data:The test completed 50 concurrent executions of 100,000 requests.The set and get value is a 256-byte string.Linux box is running Linux 2.6, which is X3320 Xeon 2.5 GHz.Text execution uses the loopback interface (127.0.0.1).Result: The write speed is 110,000 times/s, the reading speed is 81,000 times/s.Redis Common commands:In the case of DB, Redis scores have been amazing, and not to mention the Memcachedb and Tokyocabinet, the original me
static file import json return HttpResponse (json. dumps (ret) # return render(request,'upload.html ',)
The background and front-end js have a pitfall on file path reproduction:
Note: Save the image in img under static file directory (the prefix of the static file path is also static)
The path we want to introduce the image to the django front-end is:/static/img/xx.png. Note that '/' must be added before static, this magic '/' represents the main dir
Two modules for serializationJSON: Used to convert between string and Python data typesPickle: Converting between Python-specific types and Python data typesJSON offers four features: Dumps,dump,loads,loadPickle offers four functions: Dumps,dump,loads,loadWhat type of data can pickle store?
All Python-supported native types: Boolean, Integer, floating-point, plural, string, byte, None.
Lists, t
(' Shuaige ') print hash.hexdigest ()------------------------------------- ---------------------------------------------->>> hash = hashlib.md5 (' 898oafs09f ') # Add the custom information here and then encrypt >>> hash.update (' Shuaige ') >>> print hash.hexdigest () 6d1233c4e14a52379c6bc7a045411dc3There are also powerful encryption methods: Python also has an HMAC module that internally creates key and content for us to process and then encryptImport Hmach = hmac.new (' Shuaige ') h.update
:",data_stringOutput:DATA: [{‘a‘:‘A‘,‘c‘:3.0,‘b‘:(2,4)}] #python的dict类型的数据是没有顺序存储的JSON: [{"a":"A","c":3.0,"b":[2,4]}] The output of JSON is similar to data, except for some subtle changes such as Python's tuple type becoming an array of JSON, the code conversion rules for Python to JSON are:The Json.loads method handles decoding (decoding) conversions of simple data typesimport jsondata = [{‘a‘:"A",‘b‘:(2,4),‘c‘:3.0}] #list对象data_string = json.dumps(data)print "ENCODED:",data_stringdecoded = j
to do during design. Obviously, you know something about it, but a special detail may depend on the information that can be obtained later. "Later" itself has two types: (a) when the application uses the library module; (B) when running, when a certain situation exists. This class is very similar to what we call "Aspect-Oriented Programming (Aspect-Oriented Programming, AOP )". We will show an example that we think is very chic:Listing 7. metadata configuration during running
% cat dump.py#!/u
standalone Mat version (version 1.0.1), which is downloaded from the mat site.If you use ADT (which contains DDMS plugins) and also install the mat in eclipse, click "Dump HPROF" The button will automatically convert (with Hprof-conv) and open the converted Hprof file in eclipse (it actually opens with a mat).Analyze heap dumps with matStart the mat and load the Hprof file we just generated. Mat is a powerful tool to tell that all of its features are
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.