Avatar ·

Bytes - conversion from string

📁 Advanced Python Topics

data = ""Hello"".encode(""utf-8"") # convert to bytes

I can't figure out bytes... no matter how hard I try, Python gives me b'Hello'... how do I get the raw bytes of this string?

If I try with Cyrillic, it works:

data = ""Привет"".encode(""utf-8"") # b'\\xd0\\x9f\\xd1\\x80\\xd0\\xb8\\xd0\\xb2\\xd0\\xb5\\xd1\\x82'

or do I have no understanding of bytes? please explain

Avatar ·

In principle, this stack is quite fast. But you most likely just have heavily unoptimized code and/or SQL queries, no caching being used, etc. I deployed on approximately your configuration using the Apache + mod_wsgi + Nginx (for static files) stack, and such capacity was sufficient for that load. Look into MySQL query caching settings. Configuration parameters like (quote):

> query_cache_size — the size of the query cache. > query_cache_limit — the maximum size of a result set stored in the cache;  > query_cache_min_res_unit — the minimum size of a block stored in the cache;
                            

Log in to leave an answer

Blogs